Pinning GitHub Actions to commit SHAs
A step like uses: actions/checkout@v4 doesn’t name a version. It names a tag, and a tag points wherever the repository’s owner, or anyone who gets their credentials, moves it. Your workflow runs whatever commit the tag points to at the moment the job starts, with your token and any secrets the step can reach.
In March 2025 that happened to tj-actions/changed-files: its version tags were moved to a commit that printed the runner’s secrets into the build log (CVE-2025-30066). Every workflow that used the action by tag ran the new commit on its next run, and in public repositories the logs were public. Days earlier the v1 tag of reviewdog/action-setup had been moved the same way (CVE-2025-30154).
What a pin looks like
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
The part after @ is the full 40-character commit SHA. A commit can’t be changed without changing its SHA, so this line runs the same code every time. GitHub doesn’t accept a shortened SHA here.
The comment matters too. It tells the next reader which release the SHA is, and Dependabot and Renovate read it: when they update the SHA they update the comment with it. Use the most specific tag on the commit (v4.4.0, not v4), so the comment says exactly what you’re running.
Finding the commit for a tag
Ask the action’s own repository:
$ git ls-remote --tags https://github.com/actions/checkout 'v4.4.0*'
11d5960a326750d5838078e36cf38b85af677262 refs/tags/v4.4.0
This tag points straight at a commit. An annotated tag is an object of its own and is listed twice; use the SHA on the line ending in ^{}, which is the commit it points to. Don’t copy a SHA from a pull request, a blog post or a fork; the section on impostor commits below shows why.
To pin a whole repository at once, audit it and open the Fix tab: it looks up every tag and branch your workflows use, finds the most specific version tag on the same commit, and gives you the change as a patch that applies with git apply.
Keeping pins up to date
A pin freezes the action, including its bugs and vulnerabilities, so it needs something that moves it forward. Dependabot does that with a few lines in .github/dependabot.yml:
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
Each update arrives as a pull request with the new SHA, the new version in the comment, and the action’s release notes, so you read what changed before it runs. Renovate does the same with its helpers:pinGitHubActionDigests preset.
One gap: Dependabot alerts don’t cover pinned actions. GitHub’s documentation says alerts are generated only for actions referenced by version, not by SHA, so a published advisory for the version you pinned won’t raise one. poutine matches advisories by tag as well. zizmor’s known-vulnerable-actions audit looks up which tag a pinned commit carries and checks that version, but it calls GitHub’s API and needs a token; run it in CI, where the workflow’s own token will do.
Making pins a rule
GitHub’s Actions settings for a repository or an organization can require every action to be pinned to a full-length commit SHA. With that on, a workflow that uses an action by tag or branch fails instead of running. Local actions (uses: ./…) and docker:// images aren’t checked. Turn it on once the existing workflows are pinned.
What pinning doesn’t cover
What the action uses. A pinned composite action can call other actions by tag, and many actions download a tool at run time. Pinning the action you call freezes its own code, not everything it fetches.
Docker images. uses: docker://alpine:3 and container: node:22 are tags too. Pin images by digest: docker://alpine@sha256:….
Impostor commits. Forks of a repository share its storage, so GitHub serves a commit that exists only in somebody’s fork under the original repository’s name. uses: actions/checkout@<sha> runs that commit even if nobody at actions/checkout ever saw it. Take SHAs from the action’s own tags, as above. zizmor’s impostor-commit audit checks that each pinned SHA is on a branch or tag of the repository it claims to come from.
A vulnerable version. Pinning tj-actions/changed-files@v35 to its commit keeps the command injection that version has (GHSA-mcph-m25j-8j63), and as above, it hides the version from checks that match by tag. The vulnerable-action sample shows it; only an upgrade removes the problem.
Your own workflow. A pin stops someone else from changing the code you run. It does nothing for a workflow that hands that code a pull request title, a write token or every secret. The pull_request_target guide covers the most common of those problems.