Skip to content

ci: pin GitHub Actions to commit SHAs - #257

Merged
MarTrepodi merged 1 commit into
developfrom
ci/pin-actions
Nov 7, 2026
Merged

MarTrepodi merged 1 commit into
developfrom
ci/pin-actions

Conversation

@MarTrepodi

Copy link
Copy Markdown
Collaborator

Task: SEC-8 (v2.9 hardening plan, PR 7)

Closes #242

What changed

  • Every uses: line in .github/workflows/*.yml now names a full 40-character commit SHA followed by a # vX.Y.Z comment. Dependabot's existing github-actions config 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 api calls and dereferenced annotated tags to the commit. Each SHA also equals the commit the moving major tag (@v7 and so on) pointed at today, so the workflows run exactly the same code as before:

    Action Was Pinned to
    actions/checkout @v7 3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
    astral-sh/setup-uv @v7 37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
    actions/setup-python @v7 6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
    actions/upload-artifact @v7 cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
    actions/download-artifact @v8 9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
    actions/cache @v6 55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
    actions/labeler @v7 bf12e9b00b37c5c0ca2b87b79b2daf7891dbda13 # v7.0.0
    actions/setup-node @v7 949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
    pypa/gh-action-pypi-publish already pinned unchanged (7245906… # v1.14.3)
  • astral-sh/setup-uv stays 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.py fails if any workflow uses an action by tag or branch, or leaves off the # vX.Y.Z comment. Local ./ actions are exempt.

How each acceptance item was verified

  • Every uses: line matches @[0-9a-f]{40}. I wrote tests/unit/test_workflow_pins.py first and confirmed it failed on the old tags. It passes now. A grep for uses: lines that don't end in @<sha> # vX.Y.Z finds nothing. All 42 uses: lines across the 9 workflows are pinned: 41 changed here, plus the existing pypa pin.
  • All workflows pass on the PR. This can only be checked once the PR is opened, because GitHub Actions workflows can't run locally. Local checks so far:
    • All 9 workflow files parse with PyYAML, and every step's uses value is read back.
    • actionlint 1.7.12 (uvx --from actionlint-py actionlint) reports no findings.
    • tests/unit/test_release_workflow.py passes.
    • uv run ruff check src/ tests/ examples/ parity/, uv run ruff format --check src/ tests/ examples/ parity/ and uv 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.md entry.

🤖 Generated with Claude Code

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>
@github-actions github-actions Bot added ci Changes related to continuous integration processes testing labels Nov 7, 2026
@MarTrepodi
MarTrepodi merged commit 7b82b69 into develop Nov 7, 2026
12 checks passed
@MarTrepodi
MarTrepodi deleted the ci/pin-actions branch November 7, 2026 15:39
@github-actions github-actions Bot mentioned this pull request Nov 7, 2026
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Changes related to continuous integration processes testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant