A simple engine to render templates in GitHub Actions using environment variables.
Templateer is a GitHub composite action that renders template files using
envsubst based on environment variables available in the GitHub Actions step/job.
- Accepts
templateandresult - Optionally prints exported variables via
debug=true - Produces outputs:
pathandbody
- Exports environment variables to
$GITHUB_ENV(except those starting withGITHUB_) - Runs
envsubstto replace placeholders (e.g.,$VAR) in the template - Publishes the rendered file path and rendered content as outputs
| Input | Required | Default | Description |
|---|---|---|---|
template |
Yes | - | Template file path |
result |
Yes | - | Rendered output file path |
debug |
No | false |
If true, prints exported variables to logs |
| Output | Description |
|---|---|
path |
Rendered file path |
body |
Rendered content (multiline) |
# .github/templates/report.md
Hello, $NAME.
File: $FILE_NAME
Repository: $GITHUB_REPOSITORY
# .github/workflows/example.yml
name: templateer-example
on:
workflow_dispatch:
jobs:
render:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Render template
id: tpl
uses: Malnati/templateer@v1.0.0
env:
NAME: Ricardo
FILE_NAME: .reports/20251215-0100_hardcode.json
with:
template: .github/templates/report.md
result: /tmp/report.rendered.md
- name: Print path
shell: bash
run: echo "${{ steps.tpl.outputs.path }}"
- name: Print content
shell: bash
run: |
echo "-----"
echo "${{ steps.tpl.outputs.body }}"
echo "-----"
- Use placeholders in the
$VARformat (standardenvsubstsyntax). - Variables can come from
env:at the step/job level, or from previous steps via$GITHUB_ENV.
envsubstonly replaces environment variables; it does not support conditional logic.- If a variable does not exist, the placeholder may become empty in the rendered output.
See LICENSE.