@@ -62,16 +62,20 @@ Setup hierarchy:
62
62
63
63
### Security policy
64
64
65
+ {% raw %}
65
66
- **DO NOT** use self-hosted runners for a public repository
66
67
- Risk: allow arbitrary code execution on your machine.
67
68
- Configurable requirement for PR: e.g. approval from someone with write access.
68
- - Secrets from settings: ` $\{\ { secrets.PASSWORD \}\ }`
69
+ - Secrets from settings: ` ${ { secrets.PASSWORD } }`
69
70
- For self-hosted runners, store on the machine instead.
71
+ {% endraw %}
70
72
71
73
# # Techniques
72
74
# ## Expressions
73
75
74
- Use `$\{\{ <expression> \}\}` to pragmatically generate configuration.
76
+ {% raw %}
77
+ Use `${{ <expression> }}` to pragmatically generate configuration.
78
+ {% endraw %}
75
79
76
80
- Literals : null, true, 42, 'spam'
77
81
- Operators : matrix.device == 'cpu'
@@ -86,14 +90,16 @@ Use `$\{\{ <expression> \}\}` to pragmatically generate configuration.
86
90
87
91
# ## Contexts
88
92
89
- Variables of workflow information, `$\{\{ <context> \}\}`
93
+ {% raw %}
94
+ Variables of workflow information, `${{ <context> }}`
90
95
91
96
Conditional execution example :
92
97
93
98
` ` ` yaml
94
- - run: mkdir $\{\ { github.job \}\ }
95
- if: $\{\ { github.ref == 'refs/heads/main' \}\ }
99
+ - run: mkdir ${ { github.job } }
100
+ if: ${ { github.ref == 'refs/heads/main' } }
96
101
` ` `
102
+ {% endraw %}
97
103
98
104
# ## Triggering a workflow
99
105
@@ -112,15 +118,17 @@ branches:
112
118
113
119
Jobs run in parallel and may be assigned to different runners.
114
120
121
+ {% raw %}
115
122
` ` ` yaml
116
123
jobs:
117
124
job1:
118
125
job2:
119
126
needs: job1
120
127
job3:
121
- if: $\{\ { always() \}\ }
128
+ if: ${ { always() } }
122
129
needs: [job1, job2]
123
130
` ` `
131
+ {% endraw %}
124
132
125
133
[https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions)
126
134
@@ -139,8 +147,9 @@ When registering runners, set corresponding labels.
139
147
140
148
Procedurally generate build configuration combinations.
141
149
150
+ {% raw %}
142
151
` ` ` yaml
143
- runs-on: $\{\ { matrix.os \}\ }
152
+ runs-on: ${ { matrix.os } }
144
153
strategy:
145
154
matrix:
146
155
node: [8, 10, 12, 14]
@@ -152,6 +161,7 @@ strategy:
152
161
- os: macos-latest
153
162
node: 8
154
163
` ` `
164
+ {% endraw %}
155
165
156
166
[https://docs.github.com/en/actions/using-jobs/using-a-build-matrix-for-your-jobs](https://docs.github.com/en/actions/using-jobs/using-a-build-matrix-for-your-jobs
157
167
)
@@ -186,6 +196,7 @@ CI=true
186
196
187
197
# ## Setup environment variables
188
198
199
+ {% raw %}
189
200
` ` ` yaml
190
201
env:
191
202
DAY_OF_WEEK: Monday
@@ -195,11 +206,12 @@ jobs:
195
206
env:
196
207
Greeting: Hello
197
208
steps:
198
- - if: $\{\ { env.DAY_OF_WEEK == 'Monday' \}\ }
209
+ - if: ${ { env.DAY_OF_WEEK == 'Monday' } }
199
210
run: echo ”$Greeting $First_Name. Today is $DAY_OF_WEEK!”
200
211
env:
201
212
First_Name: Mona
202
213
` ` `
214
+ {% endraw %}
203
215
204
216
[https://docs.github.com/en/actions/learn-github-actions/environment-variables](https://docs.github.com/en/actions/learn-github-actions/environment-variables)
205
217
@@ -255,10 +267,12 @@ For hosted artifact storage:
255
267
256
268
Our solution for hosted runners :
257
269
270
+ {% raw %}
258
271
` ` ` yaml
259
- upload-artifacts ”Result tarballs” $\{\ { github.job \}\ }
272
+ upload-artifacts ”Result tarballs” ${ { github.job } }
260
273
result '*.tar.gz'
261
274
` ` `
275
+ {% endraw %}
262
276
263
277
- Each file is stored to a s3 bucket.
264
278
- A public link is added to the log.
@@ -295,30 +309,36 @@ However,
295
309
- No anchors and aliases (&anchor and *anchor)
296
310
- Context expansion may cause syntax errors
297
311
312
+ {% raw %}
298
313
` ` ` yaml
299
314
strategy:
300
315
matrix:
301
316
device: [cpu, gpu]
302
- runs-on: [self-hosted, $\{\ { matrix.device \}\ } ]
317
+ runs-on: [self-hosted, ${ { matrix.device } }]
303
318
` ` `
319
+ {% endraw %}
304
320
305
321
but this works :
306
322
323
+ {% raw %}
307
324
` ` ` yaml
308
325
runs-on:
309
326
- self-hosted
310
- - $\{\ { matrix.device }}
327
+ - ${ { matrix.device }}
311
328
` ` `
329
+ {% endraw %}
312
330
313
331
# ## Context availability
314
332
333
+ {% raw %}
315
334
` ` ` yaml
316
335
test-context:
317
336
steps:
318
- - name: $\{\ { github.job \}\ }
337
+ - name: ${ { github.job } }
319
338
run: ...
320
- - run: echo $\{\ { github.job \}\ }
339
+ - run: echo ${ { github.job } }
321
340
` ` `
341
+ {% endraw %}
322
342
323
343
github.job : job id (i.e. test-context)
324
344
0 commit comments