20
20
rust : ${{ steps.filter.outputs.rust }}
21
21
steps :
22
22
- uses : actions/checkout@v5
23
+ with :
24
+ persist-credentials : false
23
25
- uses : dorny/paths-filter@v3
24
26
id : filter
25
27
with :
49
51
runs-on : ubuntu-latest
50
52
steps :
51
53
- uses : actions/checkout@v5
54
+ with :
55
+ persist-credentials : false
52
56
- uses : ./.github/actions/init-env-node
53
57
- run : pnpm prettier
54
58
58
62
runs-on : ubuntu-latest
59
63
steps :
60
64
- uses : actions/checkout@v5
65
+ with :
66
+ persist-credentials : false
61
67
- uses : ./.github/actions/init-env-node
62
68
- run : pnpm lint
63
69
67
73
runs-on : ubuntu-latest
68
74
steps :
69
75
- uses : actions/checkout@v5
76
+ with :
77
+ persist-credentials : false
70
78
- uses : ./.github/actions/init-env-node
71
79
- run : pnpm check
72
80
76
84
runs-on : ubuntu-latest
77
85
steps :
78
86
- uses : actions/checkout@v5
87
+ with :
88
+ persist-credentials : false
79
89
- uses : ./.github/actions/init-env-node
80
90
- run : pnpm test
81
91
89
99
CARGO_TERM_COLOR : always
90
100
steps :
91
101
- uses : actions/checkout@v5
102
+ with :
103
+ persist-credentials : false
92
104
- run : cargo fmt --check --all
93
105
- run : cargo check --workspace --all-targets
94
106
@@ -102,6 +114,8 @@ jobs:
102
114
CARGO_TERM_COLOR : always
103
115
steps :
104
116
- uses : actions/checkout@v5
117
+ with :
118
+ persist-credentials : false
105
119
# TODO(qix-): we have to exclude the app here for now because for some
106
120
# TODO(qix-): reason it doesn't build with the docs feature enabled.
107
121
- run : cargo doc --no-deps --all-features --document-private-items -p gitbutler-git
@@ -114,6 +128,8 @@ jobs:
114
128
runs-on : ubuntu-latest
115
129
steps :
116
130
- uses : actions/checkout@v5
131
+ with :
132
+ persist-credentials : false
117
133
- uses : EmbarkStudios/cargo-deny-action@f2ba7abc2abebaf185c833c3961145a3c275caad # v2.0.13
118
134
with :
119
135
command : check bans licenses sources
@@ -129,6 +145,8 @@ jobs:
129
145
shell : bash
130
146
steps :
131
147
- uses : actions/checkout@v5
148
+ with :
149
+ persist-credentials : false
132
150
- name : Rust Cache
133
151
134
152
with :
@@ -186,9 +204,40 @@ jobs:
186
204
CARGO_TERM_COLOR : always
187
205
steps :
188
206
- uses : actions/checkout@v5
207
+ with :
208
+ persist-credentials : false
189
209
- name : Rust Cache
190
210
191
211
with :
192
212
shared-key : windows-rust-testing
193
213
- name : ' cargo check'
194
214
run : cargo check --workspace --all-targets --features windows
215
+
216
+ # Check that all `actions/checkout` in CI jobs have `persist-credentials: false`.
217
+ check-no-persist-credentials :
218
+ runs-on : ubuntu-latest
219
+
220
+ env :
221
+ GLOB : .github/workflows/*.@(yaml|yml)
222
+
223
+ steps :
224
+ - uses : actions/checkout@v5
225
+ with :
226
+ persist-credentials : false
227
+ sparse-checkout : ' .github/workflows'
228
+ - name : Generate workflows list to scan
229
+ run : |
230
+ shopt -s extglob
231
+ printf '%s\n' ${{ env.GLOB }} | grep -v .github/workflows/publish.yaml >workflows.list
232
+ cat workflows.list
233
+ echo "Note that publish.yaml is excluded until it's ensured to not need this feature"
234
+ - name : Scan workflows
235
+ run : |
236
+ shopt -s extglob
237
+ yq '.jobs.*.steps[]
238
+ | select(.uses == "actions/checkout@*" and .with.["persist-credentials"]? != false)
239
+ | {"file": filename, "line": line, "name": (.name // .uses)}
240
+ | .file + ":" + (.line | tostring) + ": " + .name
241
+ ' -- $(cat workflows.list) >query-output.txt
242
+ cat query-output.txt
243
+ test -z "$(<query-output.txt)" # Report failure if we found anything.
0 commit comments