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 :
53
+ needs : run-determination
54
+ if : needs.run-determination.outputs.result == 'true'
29
55
runs-on : ubuntu-latest
30
56
31
57
steps :
47
73
run : task go:vet
48
74
49
75
check-outdated :
76
+ needs : run-determination
77
+ if : needs.run-determination.outputs.result == 'true'
50
78
runs-on : ubuntu-latest
51
79
52
80
steps :
71
99
run : git diff --color --exit-code
72
100
73
101
check-style :
102
+ needs : run-determination
103
+ if : needs.run-determination.outputs.result == 'true'
74
104
runs-on : ubuntu-latest
75
105
76
106
steps :
95
125
run : task --silent go:lint
96
126
97
127
check-formatting :
128
+ needs : run-determination
129
+ if : needs.run-determination.outputs.result == 'true'
98
130
runs-on : ubuntu-latest
99
131
100
132
steps :
@@ -120,6 +152,8 @@ jobs:
120
152
121
153
check-config :
122
154
name : check-config (${{ matrix.module.path }})
155
+ needs : run-determination
156
+ if : needs.run-determination.outputs.result == 'true'
123
157
runs-on : ubuntu-latest
124
158
125
159
strategy :
0 commit comments