File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,12 +26,11 @@ jobs:
2626 mise exec -- pre-commit run --from-ref origin/${{ github.base_ref || 'main' }} --to-ref HEAD
2727
2828 ensure-pinned-actions :
29- runs-on : ubuntu-24.04
29+ runs-on : ubuntu-latest
3030 timeout-minutes : 5
3131 steps :
32- - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
33- - name : Ensure SHA pinned actions
34- uses : zgosalvez/github-actions-ensure-sha-pinned-actions@70c4af2ed5282c51ba40566d026d6647852ffa3e # v5.0.1
32+ - uses : actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
33+ - run : bash scripts/ensure-pinned-actions.sh
3534
3635 static_checks :
3736 runs-on : ubuntu-24.04
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -euo pipefail
3+
4+ # Verify every action reference in .github/workflows/ is pinned to a full commit SHA.
5+ # A pinned ref looks like: uses: owner/action@<40 hex chars>
6+ # Tags (@v4, @main) are rejected — they are mutable and can be hijacked.
7+
8+ unpinned=$( grep -rn --include=" *.yml" --include=" *.yaml" -E ' uses:\s+\S+@' .github/ \
9+ | grep -vE ' @[a-f0-9]{40}(\s|$|#)' || true)
10+
11+ if [ -n " $unpinned " ]; then
12+ echo " ERROR: unpinned action(s) found — use a full commit SHA instead of a tag or branch:"
13+ echo " $unpinned "
14+ exit 1
15+ fi
16+
17+ echo " OK: all actions are pinned to commit SHAs."
You can’t perform that action at this time.
0 commit comments