Skip to content

Commit 914b50b

Browse files
authored
Merge pull request #2337 from EliahKagan/zizmor
Use dependency cooldown, pinned actions, and more code scanning
2 parents 4150203 + c1a3a99 commit 914b50b

File tree

8 files changed

+136
-77
lines changed

8 files changed

+136
-77
lines changed

.github/dependabot.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,18 @@ updates:
3333
exclude-patterns:
3434
- expectrl
3535
- imara-diff
36+
cooldown:
37+
default-days: 7
3638

3739
- package-ecosystem: github-actions
3840
directory: '/'
3941
schedule:
40-
interval: weekly
42+
interval: monthly
4143
commit-message:
4244
# Avoid non-"purposeful" prefix due to Dependabot misdetecting style (see `DEVELOPMENT.md`).
4345
prefix: ''
4446
groups:
4547
github-actions:
4648
patterns: ['*']
49+
cooldown:
50+
default-days: 7

.github/workflows/ci.yml

Lines changed: 62 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ on:
66
- main
77
- 'run-ci/**'
88
- '**/run-ci/**'
9-
tags-ignore:
10-
- '*'
119
pull_request:
1210
branches:
1311
- main
@@ -37,10 +35,10 @@ jobs:
3735
shell: bash # Use `bash` even in the Windows job.
3836

3937
steps:
40-
- uses: actions/checkout@v6
38+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
4139
with:
4240
persist-credentials: false
43-
- uses: extractions/setup-just@v3
41+
- uses: extractions/setup-just@e33e0265a09d6d736e2ee1e0eb685ef1de4669ff # v3.0.0
4442
- name: Read the MSRV
4543
run: |
4644
msrv="$(just msrv)"
@@ -63,10 +61,10 @@ jobs:
6361
runs-on: ubuntu-latest
6462

6563
steps:
66-
- uses: actions/checkout@v6
64+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
6765
with:
6866
persist-credentials: false
69-
- uses: extractions/setup-just@v3
67+
- uses: extractions/setup-just@e33e0265a09d6d736e2ee1e0eb685ef1de4669ff # v3.0.0
7068
- name: Ensure we start out clean
7169
run: git diff --exit-code
7270
- name: Regenerate the MSRV badge
@@ -80,7 +78,7 @@ jobs:
8078
container: debian:stable-slim
8179

8280
steps:
83-
- uses: actions/checkout@v6
81+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
8482
with:
8583
persist-credentials: false
8684
- name: Prerequisites
@@ -186,19 +184,19 @@ jobs:
186184
runs-on: ubuntu-latest
187185

188186
steps:
189-
- uses: actions/checkout@v6
187+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
190188
with:
191189
persist-credentials: false
192190
- uses: dtolnay/rust-toolchain@stable
193-
- uses: Swatinem/rust-cache@v2
191+
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
194192
with:
195193
save-if: ${{ github.ref == 'refs/heads/main' }}
196194
- name: Setup dependencies
197195
run: |
198196
sudo apt-get update
199197
sudo apt-get install -y --no-install-recommends liblzma-dev
200-
- uses: extractions/setup-just@v3
201-
- uses: taiki-e/install-action@v2
198+
- uses: extractions/setup-just@e33e0265a09d6d736e2ee1e0eb685ef1de4669ff # v3.0.0
199+
- uses: taiki-e/install-action@cc33365ec7e3350bc47bf935f247582cc6f68344 # v2.65.12
202200
with:
203201
tool: nextest
204202
- name: test
@@ -210,14 +208,14 @@ jobs:
210208
runs-on: ubuntu-latest
211209

212210
steps:
213-
- uses: actions/checkout@v6
211+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
214212
with:
215213
persist-credentials: false
216214
- uses: dtolnay/rust-toolchain@stable
217-
- uses: Swatinem/rust-cache@v2
215+
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
218216
with:
219217
save-if: ${{ github.ref == 'refs/heads/main' }}
220-
- uses: extractions/setup-just@v3
218+
- uses: extractions/setup-just@e33e0265a09d6d736e2ee1e0eb685ef1de4669ff # v3.0.0
221219
- name: Run journey tests
222220
run: just ci-journey-tests
223221

@@ -238,25 +236,29 @@ jobs:
238236
runs-on: ${{ matrix.os }}
239237

240238
steps:
241-
- uses: actions/checkout@v6
239+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
242240
with:
243241
persist-credentials: false
244242
- uses: dtolnay/rust-toolchain@stable
245-
- uses: Swatinem/rust-cache@v2
243+
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
246244
with:
247245
save-if: ${{ github.ref == 'refs/heads/main' }}
248246
- name: cargo check default features
249247
if: startsWith(matrix.os, 'windows')
250248
run: cargo check --workspace --bins --examples
251-
- uses: taiki-e/install-action@v2
249+
- uses: taiki-e/install-action@cc33365ec7e3350bc47bf935f247582cc6f68344 # v2.65.12
252250
with:
253251
tool: nextest
254252
- name: Test (nextest)
253+
if: startsWith(matrix.os, 'windows')
255254
env:
256255
GIX_TEST_CREATE_ARCHIVES_EVEN_ON_CI: '1'
257-
run: cargo nextest run --workspace --no-fail-fast -- ${{ matrix.test-args }}
256+
run: | # zizmor: ignore[template-injection]
257+
cargo nextest run --workspace --no-fail-fast -- ${{ matrix.test-args }}
258258
- name: Check that tracked archives are up to date
259-
run: git diff --exit-code # If this fails, the fix is usually to commit a regenerated archive.
259+
run: |
260+
# If this fails, the fix is usually to commit a regenerated archive.
261+
git diff --exit-code
260262
- name: Remove Git for Windows directories from PATH
261263
if: startsWith(matrix.os, 'windows')
262264
run: |
@@ -273,7 +275,10 @@ jobs:
273275
run: if ($null -eq $Env:EXEPATH) { exit 0 } else { exit 1 }
274276
- name: Retest gix-path without `git` in `PATH` (nextest)
275277
if: startsWith(matrix.os, 'windows')
276-
run: cargo nextest run -p gix-path --no-fail-fast -- ${{ matrix.test-args }}
278+
env:
279+
TEST_ARGS: ${{ matrix.test-args }}
280+
run: |
281+
cargo nextest run -p gix-path --no-fail-fast -- (-split $Env:TEST_ARGS)
277282
278283
test-fixtures-windows:
279284
strategy:
@@ -289,22 +294,24 @@ jobs:
289294
runs-on: ${{ matrix.os }}
290295

291296
steps:
292-
- uses: actions/checkout@v6
297+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
293298
with:
294299
persist-credentials: false
295300
- uses: dtolnay/rust-toolchain@stable
296-
- uses: Swatinem/rust-cache@v2
301+
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
297302
with:
298303
save-if: ${{ github.ref == 'refs/heads/main' }}
299-
- uses: taiki-e/install-action@v2
304+
- uses: taiki-e/install-action@cc33365ec7e3350bc47bf935f247582cc6f68344 # v2.65.12
300305
with:
301306
tool: nextest
302307
- name: Test (nextest)
303308
id: nextest
304309
env:
305310
GIX_TEST_IGNORE_ARCHIVES: '1'
311+
TEST_ARGS: ${{ matrix.test-args }}
306312
run: |
307-
cargo nextest --profile=with-xml run --workspace --no-fail-fast -- ${{ matrix.test-args }}
313+
cargo nextest --profile=with-xml run --workspace --no-fail-fast -- `
314+
(-split $Env:TEST_ARGS)
308315
continue-on-error: true
309316
- name: Check for errors
310317
run: |
@@ -330,23 +337,25 @@ jobs:
330337
test-32bit:
331338
strategy:
332339
matrix:
333-
container-arch: [ i386, arm32v7 ]
340+
container-architecture: [ i386, arm32v7 ]
334341
include:
335-
- container-arch: i386
336-
runner-arch: amd64
342+
- container-architecture: i386
343+
runner-architecture: amd64
337344
runner-os: ubuntu-latest
338345
host-triple: i686-unknown-linux-gnu
339-
- container-arch: arm32v7
340-
runner-arch: arm64
346+
- container-architecture: arm32v7
347+
runner-architecture: arm64
341348
runner-os: ubuntu-24.04-arm
342349
host-triple: armv7-unknown-linux-gnueabihf
343350

344351
runs-on: ${{ matrix.runner-os }}
345352

346-
container: ${{ matrix.container-arch }}/debian:bookworm-slim
353+
container: ${{ matrix.container-architecture }}/debian:bookworm-slim
347354

348355
steps:
349356
- name: Prerequisites
357+
env:
358+
RUNNER_ARCHITECTURE: ${{ matrix.runner-architecture }}
350359
run: |
351360
prerequisites=(
352361
build-essential
@@ -356,28 +365,30 @@ jobs:
356365
git
357366
jq
358367
libssl-dev
359-
libstdc++6:${{ matrix.runner-arch }} # To support external 64-bit Node.js for actions.
368+
"libstdc++6:$RUNNER_ARCHITECTURE" # To support external 64-bit Node.js for actions.
360369
pkgconf
361370
python3-minimal
362371
)
363-
dpkg --add-architecture ${{ matrix.runner-arch }}
372+
dpkg --add-architecture "$RUNNER_ARCHITECTURE"
364373
apt-get update
365374
apt-get install --no-install-recommends -y -- "${prerequisites[@]}"
366375
shell: bash # This step needs `bash`, and the default in container jobs is `sh`.
367-
- uses: actions/checkout@v6
376+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
368377
with:
369378
persist-credentials: false
370379
- name: Install Rust via Rustup
380+
env:
381+
HOST_TRIPLE: ${{ matrix.host-triple }}
371382
run: |
372383
# Specify toolchain to avoid possible misdetection based on the 64-bit running kernel.
373384
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs |
374-
sh -s -- -y --default-host ${{ matrix.host-triple }} --profile minimal
385+
sh -s -- -y --default-host "$HOST_TRIPLE" --profile minimal
375386
- name: Add Rust tools to path
376387
run: echo "PATH=$HOME/.cargo/bin:$PATH" >> "$GITHUB_ENV"
377-
- uses: Swatinem/rust-cache@v2
388+
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
378389
with:
379390
save-if: ${{ github.ref == 'refs/heads/main' }}
380-
- uses: taiki-e/install-action@v2
391+
- uses: taiki-e/install-action@cc33365ec7e3350bc47bf935f247582cc6f68344 # v2.65.12
381392
with:
382393
tool: nextest
383394
- name: Make `system` scope nonempty for "GitInstallation" tests
@@ -394,16 +405,16 @@ jobs:
394405
TARGET: i686-pc-windows-msvc
395406

396407
steps:
397-
- uses: actions/checkout@v6
408+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
398409
with:
399410
persist-credentials: false
400411
- uses: dtolnay/rust-toolchain@stable
401412
with:
402413
targets: ${{ env.TARGET }}
403-
- uses: Swatinem/rust-cache@v2
414+
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
404415
with:
405416
save-if: ${{ github.ref == 'refs/heads/main' }}
406-
- uses: taiki-e/install-action@v2
417+
- uses: taiki-e/install-action@cc33365ec7e3350bc47bf935f247582cc6f68344 # v2.65.12
407418
with:
408419
tool: nextest
409420
- name: Test data structure sizes (nextest)
@@ -415,14 +426,14 @@ jobs:
415426
runs-on: ubuntu-latest
416427

417428
steps:
418-
- uses: actions/checkout@v6
429+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
419430
with:
420431
persist-credentials: false
421432
- uses: dtolnay/rust-toolchain@master
422433
with:
423434
toolchain: stable
424435
components: clippy,rustfmt
425-
- uses: extractions/setup-just@v3
436+
- uses: extractions/setup-just@e33e0265a09d6d736e2ee1e0eb685ef1de4669ff # v3.0.0
426437
- name: Run cargo clippy
427438
run: just clippy -D warnings -A unknown-lints --no-deps
428439
- name: Run cargo doc
@@ -447,10 +458,10 @@ jobs:
447458
runs-on: ubuntu-latest
448459

449460
steps:
450-
- uses: actions/checkout@v6
461+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
451462
with:
452463
persist-credentials: false
453-
- uses: EmbarkStudios/cargo-deny-action@v2
464+
- uses: EmbarkStudios/cargo-deny-action@76cd80eb775d7bbbd2d80292136d74d39e1b4918 # v2.0.14
454465
with:
455466
command: check advisories
456467
arguments: --workspace --all-features
@@ -459,10 +470,10 @@ jobs:
459470
runs-on: ubuntu-latest
460471

461472
steps:
462-
- uses: actions/checkout@v6
473+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
463474
with:
464475
persist-credentials: false
465-
- uses: EmbarkStudios/cargo-deny-action@v2
476+
- uses: EmbarkStudios/cargo-deny-action@76cd80eb775d7bbbd2d80292136d74d39e1b4918 # v2.0.14
466477
with:
467478
command: check bans licenses sources
468479
arguments: --workspace --all-features
@@ -480,15 +491,15 @@ jobs:
480491
TARGET: ${{ matrix.target }}
481492

482493
steps:
483-
- uses: actions/checkout@v6
494+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
484495
with:
485496
persist-credentials: false
486497
- name: Install Rust
487498
run: |
488499
rustup update stable
489500
rustup default stable
490501
rustup target add "$TARGET"
491-
- uses: Swatinem/rust-cache@v2
502+
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
492503
with:
493504
save-if: ${{ github.ref == 'refs/heads/main' }}
494505
- name: 'WASI only: crates without feature toggle'
@@ -552,22 +563,22 @@ jobs:
552563
GLOB: .github/workflows/*.@(yaml|yml)
553564

554565
steps:
555-
- uses: actions/checkout@v6
566+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
556567
with:
557568
persist-credentials: false
558569
sparse-checkout: '.github/workflows'
559570
- name: List workflows to be scanned
560571
run: |
561572
shopt -s extglob
562-
printf '%s\n' ${{ env.GLOB }}
573+
printf '%s\n' $GLOB # Pathname expansion in $GLOB intended.
563574
- name: Scan workflows
564575
run: |
565576
shopt -s extglob
566577
yq '.jobs.*.steps[]
567578
| select(.uses == "actions/checkout@*" and .with.["persist-credentials"]? != false)
568579
| {"file": filename, "line": line, "name": (.name // .uses)}
569580
| .file + ":" + (.line | tostring) + ": " + .name
570-
' -- ${{ env.GLOB }} >query-output.txt
581+
' -- $GLOB >query-output.txt # Pathname expansion in $GLOB intended.
571582
cat query-output.txt
572583
test -z "$(<query-output.txt)" # Report failure if we found anything.
573584
@@ -593,7 +604,7 @@ jobs:
593604
run: |
594605
relative_workflow_with_ref="${GITHUB_WORKFLOW_REF#"$GITHUB_REPOSITORY/"}"
595606
echo "WORKFLOW_PATH=${relative_workflow_with_ref%@*}" >> "$GITHUB_ENV"
596-
- uses: actions/checkout@v6
607+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
597608
with:
598609
persist-credentials: false
599610
sparse-checkout: ${{ env.WORKFLOW_PATH }}

0 commit comments

Comments
 (0)