Skip to content

Commit 27b0924

Browse files
committed
ci: enforce SHA pinning for GitHub Actions (leanprover-community#35617)
This PR adds an `ensure-sha-pinned-actions` job to the existing `actionlint.yml` workflow, using [`zgosalvez/github-actions-ensure-sha-pinned-actions`](https://github.com/zgosalvez/github-actions-ensure-sha-pinned-actions) to verify that all `uses:` references in workflow files are pinned to full 40-character commit SHAs rather than mutable tags. We use [our fork](https://github.com/kim-em/github-actions-ensure-sha-pinned-actions/tree/improve-error-reporting) (pinned to SHA) with improved error reporting until the upstream PR is merged: zgosalvez/github-actions-ensure-sha-pinned-actions#288. The improvements are: - Report all violations at once (upstream stops at the first per job) - File-level annotations on errors (upstream shows generic messages) All existing workflows already use SHA-pinned references, so this just enforces the policy going forward. 🤖 Prepared with Claude Code
1 parent baa5936 commit 27b0924

5 files changed

Lines changed: 16 additions & 4 deletions

File tree

.github/workflows/actionlint.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,15 @@ jobs:
1717
with:
1818
tool_name: actionlint
1919
fail_level: any
20+
21+
ensure-sha-pinned-actions:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
26+
27+
# Using our fork's PR branch until upstream merges the improved error reporting:
28+
# https://github.com/zgosalvez/github-actions-ensure-sha-pinned-actions/pull/288
29+
# TODO: Update to upstream release once merged.
30+
- name: Ensure all actions are pinned to SHA
31+
uses: kim-em/github-actions-ensure-sha-pinned-actions@00f51cdb5bbc21f5bc873ef3a2dceef45df213af # improve-error-reporting

.github/workflows/daily.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ jobs:
314314
reinstall-transient-toolchain: true
315315

316316
- name: Install Rust
317-
uses: dtolnay/rust-toolchain@stable
317+
uses: dtolnay/rust-toolchain@631a55b12751854ce901bb631d5902ceb48146f7 # stable
318318

319319
- name: Check Mathlib using nanoda # make sure this name is consistent with "Get job status and URLs" in the notify job
320320
id: nanoda

.github/workflows/nightly-docgen.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
rm -rf "$HOME/.cache/mathlib"
1919
2020
- name: Checkout mathlib
21-
uses: actions/checkout@v6.0.2
21+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2222
with:
2323
repository: leanprover-community/mathlib4-nightly-testing
2424
ref: nightly-testing-green

.github/workflows/splice_bot.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ permissions: {}
99
jobs:
1010
call-splice-bot:
1111
if: ${{ contains(github.event.comment.body, 'splice-bot') }}
12-
uses: leanprover-community/SpliceBot/.github/workflows/splice.yaml@master
12+
uses: leanprover-community/SpliceBot/.github/workflows/splice.yaml@fdb442693d6f613b25d2599ad64fd87cf019b9ce # master
1313
with:
1414
# Optional override; omit to use the reusable workflow's default "master"
1515
base_ref: master

.github/workflows/splice_bot_wf_run.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ permissions: {}
1010
jobs:
1111
run-reusable:
1212
if: ${{ github.event.workflow_run.conclusion == 'success' }}
13-
uses: leanprover-community/SpliceBot/.github/workflows/splice_wf_run.yaml@master
13+
uses: leanprover-community/SpliceBot/.github/workflows/splice_wf_run.yaml@fdb442693d6f613b25d2599ad64fd87cf019b9ce # master
1414
with:
1515
source_workflow: ${{ github.event.workflow_run.name }}
1616
push_to_fork: leanprover-community/mathlib4_copy

0 commit comments

Comments
 (0)