Skip to content

Pin GitHub Actions to commit SHAs - #441

Merged
tpowell-progress merged 1 commit into
chef:mainfrom
tas50:ci/pin-actions-to-shas
Aug 31, 2026
Merged

Pin GitHub Actions to commit SHAs#441
tpowell-progress merged 1 commit into
chef:mainfrom
tas50:ci/pin-actions-to-shas

Conversation

@tas50

@tas50 tas50 commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Every third-party action across this repo's five workflows is referenced by a mutable pointer. This converts them all to immutable commit SHAs, with the version preserved in a trailing comment.

The Ruby matrix is untouched. Both the unit and integration matrices already cover 2.6, 2.7, 3.0, 3.1, 3.2, 3.3, 3.4, and 4.0 — every released Ruby the gemspec's required_ruby_version = ">= 2.6" permits, across ubuntu, macos, and windows. There's nothing to extend here; this repo is already the most thorough of the set.

Why pin

A tag is a movable pointer. Anyone who can push to an action's repository can repoint @v1 at new code, and every workflow referencing it picks that up on the next run with no change on our side. A commit SHA can't be repointed.

Four references here weren't pinned to a version at all — they floated on a branch head, so every run picks up whatever happened to land on that branch:

actionshub/dco@main
actionshub/get-pr-commits@main
actionshub/yamllint@main
fernandrone/linelint@master

Two of those gate DCO sign-off on every PR to this repo.

The pins

Action Was Now
actions/checkout @v6 d23441a # v6.1.0
ruby/setup-ruby @v1 95ef2b0 # v1.321.0
r7kamura/rubocop-problem-matchers-action @v1 59f1a07 # v1.2.2
wechuli/allcheckspassed @v1 e22f45a # v1.2.0
DavidAnson/markdownlint-cli2-action @v22 07035fd # v22.0.0
gaurav-nelson/github-action-markdown-link-check @1.0.17 3c3b66f # 1.0.17
actionshub/dco @main 6246515 # v2.0.0
actionshub/get-pr-commits @main 0f1d778 # v2.0.0
actionshub/yamllint @main 00f4f7f # v1.8.3
fernandrone/linelint @master 7907a5d # 0.0.6

This is a conversion, not an upgrade. Each pin resolves to the newest release within the major version already in use, so behavior is unchanged — checkout stays on v6 rather than jumping to v7, and markdownlint-cli2-action stays on v22 rather than moving to v24, which would change which rules fire. The @main and @master refs are the one place a version genuinely changes, because there was no version to preserve; those resolve to the latest tagged release, since an untagged commit gives Dependabot nothing to track.

The local uses: ./.github/workflows/lint.yml and integration.yml references in ci.yml are intentionally not pinned — they resolve within this repository at the same commit.

Dependabot

SHA pins never move on their own, so pinning without automated bumping just trades a supply-chain risk for a staleness one. dependabot.yml tracked only bundler, so this registers the github-actions ecosystem alongside it. Dependabot reads the trailing # vX.Y.Z comment to determine the current version and rewrites both the SHA and the comment on each bump.

Verification

All five workflow files and dependabot.yml parse as valid YAML. Every uses: reference now resolves either to a 40-character commit SHA or to a local workflow path — verified by grepping for any ref that is neither, which returns nothing.

Tags and branch refs are mutable pointers. Anyone who can push to an action's
repository can repoint `@v1` — or `@main` — at new code, and every workflow
referencing it picks that up on the next run with no change on our side. A
commit SHA cannot be repointed.

Four references here floated on a branch head rather than any version at all:

    actionshub/dco@main
    actionshub/get-pr-commits@main
    actionshub/yamllint@main
    fernandrone/linelint@master

Each pin keeps the version in a trailing `# vX.Y.Z` comment, which is what
Dependabot reads to bump it later. Pins stay inside the major version already
in use, so this is a conversion rather than an upgrade; the `@main` and
`@master` refs move to the latest tagged release, since an untagged commit
gives Dependabot nothing to track.

Also registers the github-actions ecosystem with Dependabot, which previously
tracked only bundler. Without it the new SHA pins would freeze at today's
versions.

The Ruby matrix is left alone. Both the unit and integration matrices already
cover 2.6 through 4.0, which is every released Ruby the gemspec's
`required_ruby_version = ">= 2.6"` permits.

The local `uses: ./.github/workflows/*.yml` references in ci.yml are not
pinned; they resolve within this repository at the same commit.

Signed-off-by: Tim Smith <tsmith84@proton.me>
@tas50
tas50 requested review from a team and jaymzh as code owners August 28, 2026 16:20
@tpowell-progress
tpowell-progress merged commit 8f11051 into chef:main Aug 31, 2026
74 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.

2 participants