This GitHub action creates a string using a liquid template and a JSON or YAML object, then either creates a file or injects the result into an existing file.
The following example creates the file hello.md with the content
My name is Bob and I'm 31 years old. and creates a commit with it.
jobs:
template:
runs-on: ubuntu-latest
steps:
- uses: theappnest/template-file-action@v1
with:
template: 'My name is {{ name }} and I'm {{ age }} years old.'
target: hello.md
data: |
name: Bob
age: 31
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 'feat: create greeting'
file_pattern: hello.mdIf the file already exists it will overwrite the file. If however you'd like to inject the result into the file at a specific place you can use comments containing start and end delimiters to do so.
The following delimiters are supported:
<!-- START_TEMPLATE -->
<!-- END_TEMPLATE -->/* START_TEMPLATE */
/* END_TEMPLATE */// START_TEMPLATE
// END_TEMPLATE# START_TEMPLATE
# END_TEMPLATEdataJSON or YAML object containing template data.templateLiquid template.targetPath of file to create/inject containt into.
modulesAn array of paths to Terraform modules.