-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
115 lines (111 loc) · 3.51 KB
/
Copy pathaction.yml
File metadata and controls
115 lines (111 loc) · 3.51 KB
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: 'kamidana-action'
description: 'jinja2 cli wrapper kamidana action.'
author: 'srz_zumix'
inputs:
template:
description: 'Jinja2 template file'
required: true
output_file:
description: 'Output file path'
required: false
variables:
description: 'Input data'
required: false
input_format:
description: 'To be used with the "variables" input, can be one of: yaml,json,toml,csv,tsv,raw,env,md,markdown,spreadsheet'
default: yaml
required: false
data_files:
description: 'Input data files, supported format: yaml,json,toml'
required: false
requirements:
description: 'Additionals modules requirements.txt string'
require: false
extensions:
description: 'extension list, i18n,do,loopcontrols,with_,autoescape,debug'
required: false
additonals:
description: 'Additionals modules'
required: false
tee:
description: 'tee kamidana output'
default: false
required: false
dump_context:
description: 'dumping loading data'
default: false
required: false
working-directory:
description: 'working directory'
default: ${{ github.workspace }}
required: false
python-version:
description: 'setup-python python-version'
default: '3.13'
required: false
github_token:
description: 'github token for github filter'
default: ${{ github.token }}
required: false
debug:
description: 'enable kamidana debug'
default: false
required: false
outputs:
text:
description: "kamidana output text"
value: ${{ steps.kamidana.outputs.result }}
runs:
using: "composite"
steps:
- name: setup-python
uses: actions/setup-python@v6
with:
python-version: ${{ inputs.python-version }}
# cache: 'pip'
# cache-dependency-path: ${{ github.action_path }}/requirements.txt
if: inputs.python-version != ''
- name: pip install
env:
INPUTS_REQUIREMENTS: ${{ inputs.requirements }}
shell: bash
run: |
# Use pip3 if pip command is not found
if command -v pip &> /dev/null; then
PIP_CMD=pip
elif command -v pip3 &> /dev/null; then
PIP_CMD=pip3
else
echo "Error: Neither pip nor pip3 command found"
exit 1
fi
${PIP_CMD} install --upgrade -r ${GITHUB_ACTION_PATH}/requirements.txt
if [ -n "${INPUTS_REQUIREMENTS}" ]; then
echo "${INPUTS_REQUIREMENTS}" > "${RUNNER_TEMP}/requirements.txt"
${PIP_CMD} install --upgrade -r "${RUNNER_TEMP}/requirements.txt"
fi
- name: kamidana
shell: bash
id: kamidana
env:
INPUTS_TEMPLATE: ${{ inputs.template }}
INPUTS_OUTPUT_FILE: ${{ inputs.output_file }}
INPUTS_VARIABLES: ${{ inputs.variables }}
INPUTS_INPUT_FORMAT: ${{ inputs.input_format }}
INPUTS_DATA_FILES: ${{ inputs.data_files }}
INPUTS_EXTENSIONS: ${{ inputs.extensions }}
INPUTS_ADDITONALS: ${{ inputs.additonals }}
INPUTS_TEE: ${{ inputs.tee }}
INPUTS_DUMP_CONTEXT: ${{ inputs.dump_context }}
INPUTS_DEBUG: ${{ inputs.debug }}
GITHUB_CONTEXT: ${{ toJson(github) }}
INPUTS_CONTEXT: ${{ toJson(github.event.inputs) }}
JOB_CONTEXT: ${{ toJson(job) }}
RUNNER_CONTEXT: ${{ toJson(runner) }}
INPUTS_GITHUB_TOKEN: ${{ inputs.github_token }}
PYTHONUTF8: 1
run: "${GITHUB_ACTION_PATH}/entorypoint.sh"
working-directory: ${{ inputs.working-directory }}
branding:
icon: 'sliders'
color: 'yellow'