-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
action.yml
185 lines (169 loc) · 6.48 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
name: 'ReplaceTokens'
description: 'Replace tokens in text files with variables and/or secrets.'
author: 'Guillaume ROUCHON'
branding:
icon: 'repeat'
color: 'purple'
inputs:
sources:
description: >
A multiline list of files to replace tokens in.
Each line supports:
- multiple globbing patterns separated by a semi-colon ';' using fast-glob syntax
(you must always use forward slash '/' as a directory separator)
- outputing the result in another file adding the output path after an arrow '=>'
(if the output path is a relative path, it will be relative to the input file)
- wildcard replacement in the output file name using an asterix '*' in the input and
output file names
Example: '**/*.json; !local/ => out/*.json' will match all files ending with '.json' in
all directories and sub directories except in `local` directory and the output will be in a
sub directory `out` relative to the input file keeping the file name.
required: true
variables:
description: >
A JSON serialized object containing the variables values.
The object can be:
- an object: properties will be parsed as key/value pairs
- a string starting with '@': value is parsed as multiple glob patterns separated
by a semi-colon ';' using fast-glob syntax to JSON or YAML files
- a string starting with '$': value is parsed as an environment variable name
containing JSON encoded key/value pairs
- an array: each item must be an object or a string and will be parsed as specified
previously
Multiple entries are merge into a single list of key/value pairs and all JSON supports
comments.
Example: '[${ toJSON(vars) }}, ${ toJSON(secrets) }}]' will pass all defined variables
and secrets.
required: true
add-bom:
description: 'Add BOM when writing files.'
default: 'false'
case-insensitive-paths:
description: 'Enable case-insensitive file path matching in glob patterns (sources and variables).'
default: 'false'
chars-to-escape:
description: 'The characters to escape when using ''custom'' escape.'
encoding:
description: >
Encoding to read and write all files.
Accepted values:
- auto: detect encoding using js-chardet
- any value supported by iconv-lite
default: 'auto'
escape:
description: >
Character escape type to apply on each value.
Accepted values:
- auto: automatically apply JSON or XML escape based on file extension
- off: don't escape values
- json: JSON escape
- xml: XML escape
- custom: apply custom escape using escape-char and chars-to-escape
default: 'auto'
escape-char:
description: 'The escape character to use when using custom escape.'
if-no-files-found:
description: 'The behavior if no files are found: ignore, warn, error.'
default: 'ignore'
include-dot-paths:
description: 'Include directories and files starting with a dot ''.'' in glob matching results for sources and additionalVariables.'
default: 'false'
log-level:
description: >
The log level.
Accepted values:
- debug
- info
- warn
- error
Debug messages will always be sent to the internal debug system.
Error messages will always fail the action.
default: 'info'
missing-var-action:
description: >
The behavior if variable is not found.
Accepted values:
- none: replace the token with an empty string and log a message
- keep: leave the token and log a message
- replace: replace with the value from missing-var-default and do not
log a message
default: 'none'
missing-var-default:
description: 'Default value when variable is not found.'
default: ''
missing-var-log:
description: >
The level to log key not found messages.
Accepted values:
- off
- warn
- error
default: 'warn'
no-telemetry:
description: >
Opt out of the anonymous telemetry feature.
You can also set the 'REPLACETOKENS_TELEMETRY_OPTOUT' environment variable to '1'
or 'true'.
default: 'false'
recursive:
description: 'Enable token replacements in values recusively.'
default: 'false'
root:
description: 'The root path to use when reading files with a relative path.'
default: ${{ github.workspace }}
separator:
description: >
The separtor to use when flattening keys in variables.
Example: '{ "key": { "array": ["a1", "a2"], "sub": "s1" } }' will be flatten as
'{ "key.array.0": "a1", "key.array.1": "a2", "key.sub": "s1" }'
default: '.'
token-pattern:
description: >
The token pattern to use.
Accepted values:
- default: #{ ... }#
- azurepipelines: $( ... )
- custom: token-prefix ... token-suffix
- doublebraces: {{ ... }}
- doubleunderscores: __ ... __
- githubactions: #{{ ... }}
- octopus: #{ ... }
default: 'default'
token-prefix:
description: 'The token prefix when using ''custom'' token pattern.'
token-suffix:
description: 'The token suffix when using ''custom'' token pattern.'
transforms:
description: >
Enable transforms on values.
The syntax to apply transform on a value is '#{<transform>(<name>[,<parameters>])}#'.
Supported transforms:
- base64(name): base64 encode the value
- indent(name[, size, firstline]): indent lines in the value where size is the
indent size (default is '2') and firstline specifies if the first line must be
indented also (default is 'false')
- lower(name): lowercase the value
- raw(name): raw value (disable escaping)
- upper(name): uppercase the value
Example: 'key=#{upper(KEY1)}#' with '{ "KEY1": "value1" }' will result in 'key=VALUE1'
default: 'false'
transforms-prefix:
description: 'The tranforms prefix when using transforms.'
default: '('
transforms-suffix:
description: 'The tranforms suffix when using transforms.'
default: ')'
outputs:
defaults:
description: 'Number of tokens replaced by the default value.'
files:
description: 'Number of files processed.'
replaced:
description: 'Number of tokens replaced with a value.'
tokens:
description: 'Number of tokens found.'
transforms:
description: 'Number of transforms applied.'
runs:
using: node20
main: dist/index.js