Repository navigation
ci: pin GitHub Actions to commit SHAs - #257
Merged
Merged
Conversation
Pin every third-party `uses:` line in .github/workflows to the full 40-character commit SHA of the latest release in the major version already in use, with a `# vX.Y.Z` comment so Dependabot's github-actions updates keep bumping them. Each SHA equals the commit the moving major tag pointed at when pinned, so behaviour is unchanged. The existing pypa/gh-action-pypi-publish pin is kept. Add tests/unit/test_workflow_pins.py to fail if a workflow uses an action by tag or branch, or drops the version comment. Refs #242 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 tasks
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Task: SEC-8 (v2.9 hardening plan, PR 7)
Closes #242
What changed
Every
uses:line in.github/workflows/*.ymlnow names a full 40-character commit SHA followed by a# vX.Y.Zcomment. Dependabot's existinggithub-actionsconfig reads these comments and will keep bumping the pins.Each SHA is the commit of the latest release within the major version already in use. I resolved them with read-only
gh apicalls and dereferenced annotated tags to the commit. Each SHA also equals the commit the moving major tag (@v7and so on) pointed at today, so the workflows run exactly the same code as before:@v73d3c42e5aac5ba805825da76410c181273ba90b1# v7.0.1@v737802adc94f370d6bfd71619e3f0bf239e1f3b78# v7.6.0@v76d4fd22b20465ccc0f7354476588e8df7c9ca0e0# v7.1.0@v7cf430e030ddbb5b0abf93d22962f4752f3646cd9# v7.0.2@v89000827ccba6bdab643e8b6fd33ac0654aef8333# v8.0.2@v655cc8345863c7cc4c66a329aec7e433d2d1c52a9# v6.1.0@v7bf12e9b00b37c5c0ca2b87b79b2daf7891dbda13# v7.0.0@v7949feb2413d6458794dcd2491c4babbbce0c15c1# v7.1.07245906…# v1.14.3)astral-sh/setup-uvstays on v7 even though its latest release is v10.3.3. Moving to a new major version is outside this PR's scope, and Dependabot will propose it.New guard test
tests/unit/test_workflow_pins.pyfails if any workflow uses an action by tag or branch, or leaves off the# vX.Y.Zcomment. Local./actions are exempt.How each acceptance item was verified
uses:line matches@[0-9a-f]{40}. I wrotetests/unit/test_workflow_pins.pyfirst and confirmed it failed on the old tags. It passes now. Agrepforuses:lines that don't end in@<sha> # vX.Y.Zfinds nothing. All 42uses:lines across the 9 workflows are pinned: 41 changed here, plus the existing pypa pin.usesvalue is read back.actionlint1.7.12 (uvx --from actionlint-py actionlint) reports no findings.tests/unit/test_release_workflow.pypasses.uv run ruff check src/ tests/ examples/ parity/,uv run ruff format --check src/ tests/ examples/ parity/anduv run ty check src/swgoh_comlink/are all clean.uv run pytest tests/unit -q: 1624 passed.Migration notes
None. This only changes CI. Library behaviour and public API are unchanged, so there is no
docs/migration.mdentry.🤖 Generated with Claude Code