Skip to content

Update GitHub Actions to latest versions and pin to commit SHAs - #152

Merged
paulirwin merged 1 commit into
masterfrom
update-pin-github-actions
Aug 14, 2026
Merged

paulirwin merged 1 commit into
masterfrom
update-pin-github-actions

Conversation

@paulirwin

Copy link
Copy Markdown
Owner

Both actions in build.yml were still on @v1, several major versions behind. This updates them and pins each to a commit SHA.

Action Before After SHA
actions/checkout v1 v7.0.1 3d3c42e5aac5ba805825da76410c181273ba90b1
actions/setup-dotnet v1 v6.0.0 a98b56852c35b8e3190ac28c8c2271da59106c68

Why SHA-pin

A version tag is mutable — whoever controls the action repo can move v7 to point at different code after the fact, and the workflow silently picks it up on the next run. A commit SHA is immutable, so CI runs the code that was actually reviewed here. This is what GitHub's security hardening guide recommends for third-party actions. The version is kept in a trailing comment so the file stays readable and future updates are obvious.

The trade-off is that SHA pins don't auto-receive patch updates. If that becomes a maintenance burden, Dependabot understands this exact format (uses: owner/action@<sha> # vX.Y.Z) and will raise PRs that bump both the SHA and the comment together — happy to add a .github/dependabot.yml in a follow-up if you'd like.

Verification

  • Each tag resolved to its commit SHA via the GitHub API, then each SHA independently confirmed to exist in its repo (prep v7.0.1 release (#2531) and chore(deps): bump @actions/cache to 6.2.0 (#756) respectively) — not transcribed by hand.
  • Workflow YAML re-parsed after editing: both jobs intact, 6 steps each, dotnet-version: 10.x unchanged.
  • Diff touches only the four uses: lines.

CI on this PR exercises the new versions directly — worth a look at the run before merging, since the v1v7/v6 jump crosses several major versions of the runner-side action code.

🤖 Generated with Claude Code

Both actions were still on @v1, which is several major versions behind:

- actions/checkout      v1 -> v7.0.1
- actions/setup-dotnet  v1 -> v6.0.0

Pin each to the full commit SHA of its release tag, with the version in a
trailing comment so the intent stays readable. Mutable tags can be moved
to point at different code after the fact, so a SHA is the only reference
that guarantees the workflow runs the code that was reviewed. This is also
what GitHub's own hardening guide recommends for third-party actions.

Only the `uses:` lines change; job structure, steps and dotnet-version are
untouched.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@paulirwin
paulirwin merged commit 74c409d into master Aug 14, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant