You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/11/en/part11d.md
+18-4Lines changed: 18 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -280,7 +280,7 @@ You most likely need functions [contains](https://docs.github.com/en/actions/lea
280
280
281
281
Developing workflows is not easy, and quite often the only option is trial and error. It might actually be advisable to have a separate repository for getting the configuration right, and when it is done, to copy the right configurations to the actual repository.
282
282
283
-
It would also make sense to re-use longer conditions by moving them to commonly accessible variables and referring these variables on job/step levels:
283
+
It would also make sense to re-use longer conditions by moving them to commonly accessible variables and referring these variables on the step level:
284
284
285
285
```yaml
286
286
name: some workflow name
@@ -292,17 +292,31 @@ env:
292
292
jobs:
293
293
job1:
294
294
# rest of the job
295
+
outputs:
296
+
# here we produce a record of the outcome of a key step in the job.
# this is important, the id `final` is referenced in job1's `outputs`.
308
+
id: final
309
+
run: echo
310
+
302
311
job2:
303
-
# this job will be dependent on the above env.CONDITION, note the `github.` prefix which seem to be required while referencing the variable on the job level, but not the step level
304
-
if: ${{ github.env.CONDITION == 'true' }}
305
-
# rest of the job
312
+
needs:
313
+
- job1
314
+
# this job will be dependent on the above job1's final step, which in turn depends on the CONDITION defined at the beginning of the file.
315
+
# note that the `env`-variable cannot be directly accessed on the job level, so we need to use something else,
It would also be possible to install a tool such as [act](https://github.com/nektos/act) that makes it possible to run your workflows locally. Unless you end up using more involved use cases like creating your [own custom actions](https://docs.github.com/en/free-pro-team@latest/actions/creating-actions), going through the burden of setting up a tool such as act is most likely not worth the trouble.
0 commit comments