Skip to content

Commit 6a2c7f2

Browse files
committed
Update GitHub Actions cheat sheet
1 parent 9605232 commit 6a2c7f2

File tree

1 file changed

+44
-1
lines changed

1 file changed

+44
-1
lines changed

content/articles/GitHub/Actions/cheat-sheet.md

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,44 @@ runs-on: windows-latest
4343
runs-on: macos-latest
4444
```
4545

46+
> [!TIP]
47+
> The runners come with all sort of **pre-installed software** like .NET or PowerShell.
48+
>
49+
> For the list, see: workflow log → `Set up job` → `Runner Image` → `Included Software`
50+
4651
*See also:*
4752

4853
* [Available Runners](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#choosing-github-hosted-runners)
4954
* [Overview of GitHub-hosted Runners](https://docs.github.com/en/actions/concepts/runners/github-hosted-runners)
5055

56+
### Run Job even if Needed Job Failed
57+
58+
By default, dependent jobs only run if their dependency jobs were successful.
59+
60+
**Always run:**
61+
62+
```yaml
63+
jobs:
64+
build-and-test:
65+
...
66+
test-report:
67+
needs: build-and-test
68+
if: ${{ !cancelled() }}
69+
```
70+
71+
**Run if successful or specific step has failed:**
72+
73+
```yaml
74+
jobs:
75+
build-and-test:
76+
outputs:
77+
run_tests_conclusion: ${{ steps.run_tests.conclusion }}
78+
...
79+
test-report:
80+
needs: build-and-test
81+
if: ${{ !cancelled() && (needs.build-and-test.result == 'success' || needs.build-and-test.outputs.run_tests_conclusion == 'failure') }}
82+
```
83+
5184
## Triggers
5285

5386
**On push to main:**
@@ -73,6 +106,16 @@ on:
73106
workflow_dispatch:
74107
```
75108

109+
**Reusable workflows (see [details](https://docs.github.com/en/actions/how-tos/reuse-automations/reuse-workflows)):**
110+
111+
```yaml
112+
on:
113+
workflow_call:
114+
```
115+
116+
> [!TIP]
117+
> **Don't use the `schedule`** trigger as this will cause the workflow to be disabled after 60 days of inactivity - and afterward the workflow must be **manually reenabled**.
118+
76119
*See also:*
77120

78121
* [All Trigger Events](https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows)
@@ -82,7 +125,7 @@ on:
82125

83126
Whether you're notified about all action runs or just failures, is configured in the **[notification settings of your account](https://github.com/settings/notifications) - *not* on the workflow itself**.
84127

85-
## Capture Job Step Output
128+
## Capture Step Output
86129

87130
Define it via:
88131

0 commit comments

Comments
 (0)