-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
95 lines (87 loc) · 2.7 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
---
name: 'Render J2 Template'
description: 'Renders a J2 Template'
inputs:
template:
description: 'The path to the template file to render'
required: true
data:
description: 'The path to the file with data to pass to the render'
required: false
default: ''
format:
description: 'The format the data file will be in'
required: false
default: ''
env_vars:
description: |
The environment variables to pass to the render. Each environment
variable should be in format VAR=VAL with one on each line.
Example:
env_vars: |
FOO=bar
BAR=baz
required: false
default: ''
filters:
description: 'Load custom Jinja2 filters from a Python file: all top-level functions are imported.'
required: false
default: ''
tests:
description: 'Load custom Jinja2 tests from a Python file.'
required: false
default: ''
customize:
description: 'A Python file that implements hooks to fine-tune the j2cli behavior'
required: false
default: ''
undefined:
description: 'If true, undefined variables will be used in templates (no error will be raised)'
required: false
default: 'false'
output:
description: 'The name of the output file to write rendered contents to'
required: false
default: output
debug:
description: 'If true, sets -x in the shell command'
required: false
default: 'false'
outputs:
file:
description: 'The file the rendered content was written to'
value: ${{ steps.render.outputs.file }}
content:
description: 'The rendered content'
value: ${{ steps.render.outputs.content }}
runs:
using: 'composite'
steps:
- name: 'Setup python'
uses: actions/setup-python@v4
with:
python-version-file: ${{ github.action_path }}/.python-version
- name: 'Cache python dependencies'
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles(join(fromJSON('["${{ github.action_path }}", "requirements.txt"]'), '/')) }}
restore-keys: ${{ runner.os }}-pip-
- name: 'Install dependencies'
shell: bash
run: pip install -r "${{ github.action_path }}/requirements.txt"
- name: 'Render'
id: render
shell: bash
run: "${{ github.action_path }}/src/render.sh"
env:
TEMPLATE: ${{ inputs.template }}
DATA: ${{ inputs.data }}
FORMAT: ${{ inputs.format }}
ENV_VARS: ${{ inputs.env_vars }}
FILTERS: ${{ inputs.filters }}
TESTS: ${{ inputs.tests }}
CUSTOMIZE: ${{ inputs.customize }}
UNDEFINED: ${{ inputs.undefined }}
OUTPUT: ${{ inputs.output }}
DEBUG: ${{ inputs.debug }}