Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cuchi/jinja2-action
Use the Jinja2 template engine as a GitHub action
https://github.com/cuchi/jinja2-action
hacktoberfest jinja2
Last synced: 2 months ago
JSON representation
Use the Jinja2 template engine as a GitHub action
- Host: GitHub
- URL: https://github.com/cuchi/jinja2-action
- Owner: cuchi
- Created: 2020-02-07T17:17:00.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-11-09T17:49:34.000Z (about 1 year ago)
- Last Synced: 2024-10-22T03:19:08.962Z (3 months ago)
- Topics: hacktoberfest, jinja2
- Language: Python
- Homepage:
- Size: 29.3 KB
- Stars: 43
- Watchers: 2
- Forks: 26
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-actions - Apply templates with Jinja2 - Use the Jinja2 template engine to generate files from templates. (Community Resources / Utility)
- fucking-awesome-actions - Apply templates with Jinja2 - Use the Jinja2 template engine to generate files from templates. (Community Resources / Utility)
- awesome-workflows - Apply templates with Jinja2 - Use the Jinja2 template engine to generate files from templates. (Community Resources / Utility)
README
[![release](https://img.shields.io/github/v/release/cuchi/jinja2-action?style=flat-square)](https://github.com/cuchi/jinja2-action/releases/latest)
[![marketplace](https://img.shields.io/badge/marketplace-jinja2--action-blue?logo=github&style=flat-square)](https://github.com/marketplace/actions/jinja2-action)Jinja2 is a fast and straightforward templating engine. You can use this action
to easily run it in your GitHub workflows.# Using input variables
```yml
- name: Setup nginx
uses: cuchi/[email protected]
with:
template: infra/nginx.conf.j2
output_file: infra/nginx.conf
strict: true
variables: |
server_host=staging.example.com
timeout=30s
```# Using data files
```yml
- name: Setup nginx
uses: cuchi/[email protected]
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
```yml
- name: Setup nginx
uses: cuchi/[email protected]
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
- [Jinja2 docs](https://jinja.palletsprojects.com/)