|
7 | 7 |
|
8 | 8 | # See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
|
9 | 9 | on:
|
| 10 | + create: |
10 | 11 | push:
|
11 | 12 | paths:
|
12 | 13 | - ".github/workflows/check-go-task.ya?ml"
|
|
25 | 26 | repository_dispatch:
|
26 | 27 |
|
27 | 28 | jobs:
|
| 29 | + run-determination: |
| 30 | + runs-on: ubuntu-latest |
| 31 | + outputs: |
| 32 | + result: ${{ steps.determination.outputs.result }} |
| 33 | + steps: |
| 34 | + - name: Determine if the rest of the workflow should run |
| 35 | + id: determination |
| 36 | + run: | |
| 37 | + RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x" |
| 38 | + # The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead. |
| 39 | + if [[ \ |
| 40 | + "${{ github.event_name }}" != "create" || \ |
| 41 | + "${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX \ |
| 42 | + ]]; then |
| 43 | + # Run the other jobs. |
| 44 | + RESULT="true" |
| 45 | + else |
| 46 | + # There is no need to run the other jobs. |
| 47 | + RESULT="false" |
| 48 | + fi |
| 49 | +
|
| 50 | + echo "::set-output name=result::$RESULT" |
| 51 | +
|
28 | 52 | check-errors:
|
29 | 53 | name: check-errors (${{ matrix.module.path }})
|
| 54 | + needs: run-determination |
| 55 | + if: needs.run-determination.outputs.result == 'true' |
30 | 56 | runs-on: ubuntu-latest
|
31 | 57 |
|
32 | 58 | strategy:
|
|
59 | 85 |
|
60 | 86 | check-outdated:
|
61 | 87 | name: check-outdated (${{ matrix.module.path }})
|
| 88 | + needs: run-determination |
| 89 | + if: needs.run-determination.outputs.result == 'true' |
62 | 90 | runs-on: ubuntu-latest
|
63 | 91 |
|
64 | 92 | strategy:
|
|
94 | 122 |
|
95 | 123 | check-style:
|
96 | 124 | name: check-style (${{ matrix.module.path }})
|
| 125 | + needs: run-determination |
| 126 | + if: needs.run-determination.outputs.result == 'true' |
97 | 127 | runs-on: ubuntu-latest
|
98 | 128 |
|
99 | 129 | strategy:
|
@@ -129,6 +159,8 @@ jobs:
|
129 | 159 |
|
130 | 160 | check-formatting:
|
131 | 161 | name: check-formatting (${{ matrix.module.path }})
|
| 162 | + needs: run-determination |
| 163 | + if: needs.run-determination.outputs.result == 'true' |
132 | 164 | runs-on: ubuntu-latest
|
133 | 165 |
|
134 | 166 | strategy:
|
@@ -164,6 +196,8 @@ jobs:
|
164 | 196 |
|
165 | 197 | check-config:
|
166 | 198 | name: check-config (${{ matrix.module.path }})
|
| 199 | + needs: run-determination |
| 200 | + if: needs.run-determination.outputs.result == 'true' |
167 | 201 | runs-on: ubuntu-latest
|
168 | 202 |
|
169 | 203 | strategy:
|
|
0 commit comments