6
6
- main
7
7
tags :
8
8
- " *"
9
- paths-ignore :
10
- - " docs/**"
11
9
12
10
pull_request :
13
11
@@ -32,9 +30,48 @@ concurrency:
32
30
cancel-in-progress : ${{ github.event_name == 'pull_request' }}
33
31
34
32
jobs :
33
+ changes :
34
+ runs-on : ubuntu-latest
35
+ outputs :
36
+ docs-only : ${{ steps.filter.outputs.docs_count == steps.filter.outputs.all_count }}
37
+ go : ${{ steps.filter.outputs.go }}
38
+ sh : ${{ steps.filter.outputs.sh }}
39
+ steps :
40
+ # For pull requests it's not necessary to checkout the code
41
+ - uses : dorny/paths-filter@v2
42
+ id : filter
43
+ with :
44
+ filters : |
45
+ all:
46
+ - '**'
47
+ docs:
48
+ - 'docs/**'
49
+ # For testing:
50
+ # - '.github/**'
51
+ go:
52
+ - "**.go"
53
+ - "**.mod"
54
+ - "**.sum"
55
+ sh:
56
+ - "**.sh"
57
+ - id : debug
58
+ run : |
59
+ echo "${{ toJSON(steps.filter )}}"
60
+
61
+ # Debug step
62
+ show-changes :
63
+ needs : changes
64
+ runs-on : ubuntu-latest
65
+ steps :
66
+ - id : log
67
+ run : |
68
+ echo "${{ toJSON(needs.changes) }}"
69
+
35
70
style-lint-golangci :
36
71
name : style/lint/golangci
37
72
timeout-minutes : 5
73
+ needs : changes
74
+ if : needs.changes.outputs.go == 'true'
38
75
runs-on : ubuntu-latest
39
76
steps :
40
77
- uses : actions/checkout@v3
50
87
name : style/lint/shellcheck
51
88
timeout-minutes : 5
52
89
runs-on : ubuntu-latest
90
+ needs : changes
91
+ if : needs.changes.outputs.sh == 'true'
53
92
steps :
54
93
- uses : actions/checkout@v3
55
94
- name : Run ShellCheck
62
101
style-lint-typescript :
63
102
name : " style/lint/typescript"
64
103
timeout-minutes : 5
104
+ needs : changes
105
+ if : needs.changes.outputs.docs-only == 'false'
65
106
runs-on : ubuntu-latest
66
107
steps :
67
108
- name : Checkout
89
130
name : " style/gen"
90
131
timeout-minutes : 5
91
132
runs-on : ubuntu-latest
133
+ needs : changes
134
+ if : needs.changes.outputs.docs-only == 'false'
92
135
steps :
93
136
- uses : actions/checkout@v3
94
137
@@ -124,6 +167,8 @@ jobs:
124
167
125
168
style-fmt :
126
169
name : " style/fmt"
170
+ needs : changes
171
+ if : needs.changes.outputs.docs-only == 'false'
127
172
runs-on : ubuntu-latest
128
173
timeout-minutes : 5
129
174
steps :
@@ -156,6 +201,8 @@ jobs:
156
201
157
202
test-go :
158
203
name : " test/go"
204
+ needs : changes
205
+ if : needs.changes.outputs.docs-only == 'false'
159
206
runs-on : ${{ matrix.os }}
160
207
timeout-minutes : 20
161
208
strategy :
@@ -232,6 +279,8 @@ jobs:
232
279
233
280
test-go-postgres :
234
281
name : " test/go/postgres"
282
+ needs : changes
283
+ if : needs.changes.outputs.docs-only == 'false'
235
284
runs-on : ubuntu-latest
236
285
# This timeout must be greater than the timeout set by `go test` in
237
286
# `make test-postgres` to ensure we receive a trace of running
@@ -303,7 +352,10 @@ jobs:
303
352
name : " deploy"
304
353
runs-on : ubuntu-latest
305
354
timeout-minutes : 30
306
- if : github.ref == 'refs/heads/main' && !github.event.pull_request.head.repo.fork
355
+ needs : changes
356
+ if : |
357
+ github.ref == 'refs/heads/main' && !github.event.pull_request.head.repo.fork
358
+ && needs.changes.outputs.docs-only == 'false'
307
359
permissions :
308
360
contents : read
309
361
id-token : write
@@ -409,6 +461,8 @@ jobs:
409
461
410
462
test-js :
411
463
name : " test/js"
464
+ needs : changes
465
+ if : needs.changes.outputs.docs-only == 'false'
412
466
runs-on : ubuntu-latest
413
467
timeout-minutes : 20
414
468
steps :
@@ -462,6 +516,8 @@ jobs:
462
516
463
517
test-e2e :
464
518
name : " test/e2e/${{ matrix.os }}"
519
+ needs : changes
520
+ if : needs.changes.outputs.docs-only == 'false'
465
521
runs-on : ${{ matrix.os }}
466
522
timeout-minutes : 20
467
523
strategy :
0 commit comments