Skip to content

cuchi/jinja2-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Jan 17, 2025
8bd8013 · Jan 17, 2025

History

44 Commits
Oct 18, 2020
Jul 9, 2020
Oct 18, 2020
Oct 18, 2020
Oct 17, 2020
Jan 8, 2025
Jan 17, 2025
Jul 8, 2020
Oct 17, 2020
Oct 18, 2020
Oct 17, 2020
Oct 17, 2020
Oct 17, 2020
Oct 18, 2020

Repository files navigation

release marketplace

Jinja2 is a fast and straightforward templating engine. You can use this action to easily run it in your GitHub workflows.

Using input variables

- name: Setup nginx
  uses: cuchi/jinja2-action@v1.3.0
  with:
    template: infra/nginx.conf.j2
    output_file: infra/nginx.conf
    strict: true
    variables: |
      server_host=staging.example.com
      timeout=30s

Using data files

- name: Setup nginx
  uses: cuchi/jinja2-action@v1.3.0
  with:
    template: infra/nginx.conf.j2
    output_file: infra/nginx.conf
    data_file: staging_config.json
    data_format: json # Will try to guess from the extension instead (unnecessary in this case)

Using environment variables

- name: Setup nginx
  uses: cuchi/jinja2-action@v1.3.0
  with:
    template: infra/nginx.conf.j2
    output_file: infra/nginx.conf
  env:
    SERVER_HOST: staging.example.com

Environment variables are used this way in the template file:

{{ env['SERVER_HOST'] }} <-- This is always strict
{{ env.get('SERVER_HOST') }} <-- This is never strict, and displays `None` if you don't specify a default value

See also