@@ -20,8 +20,24 @@ permissions:
20
20
contents : read
21
21
22
22
jobs :
23
+ pre-check :
24
+ name : Check (precheck)
25
+ if : ${{ github.event_name == 'pull_request' }}
26
+ runs-on : ubuntu-latest
27
+ outputs :
28
+ skip_checks : ${{ steps.changes.outputs.nonMarkdownFiles == 'false' }}
29
+ steps :
30
+ - uses : actions/checkout@v4
31
+ - id : changes
32
+ uses : dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
33
+ with :
34
+ filters : |
35
+ nonMarkdownFiles:
36
+ - '!**/*.md'
23
37
check-gen :
24
38
name : Check (gen-check)
39
+ needs : [pre-check]
40
+ if : ${{ needs.pre-check.outputs.skip_checks != 'true' }}
25
41
runs-on : ubuntu-latest
26
42
steps :
27
43
- uses : actions/checkout@v4
37
53
- run : git diff --exit-code
38
54
check-lint :
39
55
name : Check (lint-all)
56
+ needs : [pre-check]
57
+ if : ${{ needs.pre-check.outputs.skip_checks != 'true' }}
40
58
runs-on : ubuntu-latest
41
59
steps :
42
60
- uses : actions/checkout@v4
49
67
- run : make lint
50
68
check-fmt :
51
69
name : Check (gofmt)
70
+ needs : [pre-check]
71
+ if : ${{ needs.pre-check.outputs.skip_checks != 'true' }}
52
72
runs-on : ubuntu-latest
53
73
steps :
54
74
- uses : actions/checkout@v4
60
80
- run : git diff --exit-code
61
81
check-mod-tidy :
62
82
name : Check (mod-tidy-check)
83
+ needs : [pre-check]
84
+ if : ${{ needs.pre-check.outputs.skip_checks != 'true' }}
63
85
runs-on : ubuntu-latest
64
86
steps :
65
87
- uses : actions/checkout@v4
69
91
- uses : ./.github/actions/install-go
70
92
- run : go mod tidy -v
71
93
- run : git diff --exit-code
94
+ post-check :
95
+ name : Check (postcheck)
96
+ needs : [check-gen, check-lint, check-fmt, check-mod-tidy]
97
+ if : ${{ !cancelled() }}
98
+ runs-on : ubuntu-latest
99
+ steps :
100
+ - env :
101
+ failure : ${{ needs.check-gen.result == 'failure' || needs.check-lint.result == 'failure' || needs.check-fmt.result == 'failure' || needs.check-mod-tidy.result == 'failure' }}
102
+ run : |
103
+ if [[ "$failure" == "true" ]]; then
104
+ echo "Some checks failed, see the workflow results for more information."
105
+ exit 1
106
+ fi
107
+ shell : bash
0 commit comments