Update GitHub Actions to latest versions and pin to commit SHAs - #152
Merged
Merged
Conversation
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>
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.
Both actions in
build.ymlwere still on@v1, several major versions behind. This updates them and pins each to a commit SHA.actions/checkoutv1v7.0.13d3c42e5aac5ba805825da76410c181273ba90b1actions/setup-dotnetv1v6.0.0a98b56852c35b8e3190ac28c8c2271da59106c68Why SHA-pin
A version tag is mutable — whoever controls the action repo can move
v7to 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.ymlin a follow-up if you'd like.Verification
prep v7.0.1 release (#2531)andchore(deps): bump @actions/cache to 6.2.0 (#756)respectively) — not transcribed by hand.dotnet-version: 10.xunchanged.uses:lines.CI on this PR exercises the new versions directly — worth a look at the run before merging, since the
v1→v7/v6jump crosses several major versions of the runner-side action code.🤖 Generated with Claude Code