In our GitHub Actions workflows, every uses: that calls an action from another repository used to point to a commit SHA. It was safer, but hard to read, and upgrading an action took extra work.
In October 2026, GitHub's workflow lockfiles became generally available. Like package-lock.json, a lockfile records the commit of each action you use in a single file. We started using it in the Metronome.fm CI and switched uses: back to tags such as actions/checkout@v4.4.0.
This post covers what the lockfile changes, how we set it up, and how CI catches a lockfile you forgot to update.
Until now, uses: pointed to commit SHAs
In uses: actions/checkout@v4, v4 is a tag. The owner of an action can move a tag to a different commit at any time. If the owner's account is taken over, the tag can be moved to a commit with malicious code, and our workflows would run it without us noticing.
So we pointed every external action to a commit SHA and kept the tag in a comment at the end of the line.
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0This keeps the code that runs from changing, but it is hard to read, and upgrading means looking up the SHA of the new tag and rewriting the line.
Dependabot, or pnpm update --include-github-actions in pnpm 11.16.0 and later, can automate that rewrite. Metronome.fm doesn't use Dependabot, though, and we stay on pnpm 10 because that's the latest version our host, Vercel, supports automatically, so neither option was available.
What the lockfile changes
The lockfile lives at .github/workflows/actions.lock. It lists the actions each workflow uses, and for each action records the tag, the commit, and the repository ID.
For workflows covered by the lockfile, the runner checks the lockfile when a job starts and runs only the code at the recorded commit. Every action such a workflow uses must be in the lockfile. You can add workflows one at a time or all at once.
The runner executes the recorded commit regardless of where the tag currently points. The tag is only checked to notice if it has been moved: if the recorded commit can no longer be reached from the recorded tag, the runner refuses to run the job. The runner also compares repository IDs, so if a repository is deleted and someone else creates one with the same name, it is not treated as the same repository.
Writing SHAs in uses: can't pin actions that are used inside another action (transitive dependencies), because they never appear in our files. The lockfile records those too.
Only action code is pinned. Inputs, secrets, runner images, and service container (services:) images are not covered. Reusable workflows from other repositories (jobs.<id>.uses) are not locked yet either.
Setting it up
The lockfile is created with the GitHub CLI extension gh actions-lock.
gh extension install github/gh-actions-lockFirst, we switched uses: back to tags. The tags were still in the end-of-line comments, so a find-and-replace was enough.
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
+ uses: actions/checkout@v4.4.0Then, running gh actions-lock in the repository looks up the actions the workflows use and writes actions.lock.
# actions.lock (excerpt)
workflows:
'.github/workflows/build.yml':
- 'actions/checkout@v4.4.0'
- 'actions/setup-node@v4.4.0'
- 'pnpm/action-setup@v4.3.0'
dependencies:
'actions/checkout@v4.4.0':
ref: 'v4.4.0'
commit: 'sha1-11d5960a326750d5838078e36cf38b85af677262'
owner_id: 44036562
repo_id: 197814629
# …Every recorded commit matched the SHA we had written in uses:, so the code that runs in CI did not change. The actions we use today have no transitive dependencies, so the lockfile pins exactly the same commits our SHAs did. Once we use an action that calls other actions, those inner actions will be pinned only by the lockfile.
gh actions-lock also warned that the Postgres and Redis service containers in our E2E tests don't reference their images by digest (@sha256:…). Those are outside the lockfile's scope, so we left them alone this time.
Catching a stale lockfile in CI
If you change a uses: and forget to run gh actions-lock, the lockfile and the workflow disagree. The runner only notices when that workflow runs. Some of our workflows, like the release one, run only when a tag is pushed, so a mismatch there would go unnoticed until release time.
So we run gh actions-lock --verify in CI to check every workflow on each push. --verify doesn't modify any files. It fails when an action is missing from the lockfile or when the runner would reject a recorded commit, for example because it is no longer reachable from its tag.
We could have added a new workflow for this. But the Metronome.fm repository is private and draws on the GitHub Actions included minutes, which are counted per job and rounded up to the minute. So instead of adding a job, we added one step to the existing build workflow, right after the repository is checked out.
- name: Verify workflow lockfile
run: |
gh extension install github/gh-actions-lock --pin v0.4.0
gh actions-lock --verify
env:
GH_TOKEN: ${{ github.token }}The extension installed in this step is outside the lockfile, so we pin its version with --pin. The extension downloads its executable from a release, and passing a commit SHA to --pin failed because no release matched it. So we pin to the tag instead. That's still safe: this extension's releases are immutable releases (once published, neither the tag nor the files can be replaced), so the contents of v0.4.0 won't change.
Upgrading an action
From now on, we change the tag in uses:, run gh actions-lock, and commit the workflow and the lockfile together. No more looking up SHAs.
In repositories that upgrade actions with Dependabot, the pull requests Dependabot opens update the lockfile as well.
The lockfile diff shows the tag and the commit side by side. When reviewing, we check both diffs to make sure the tag is the version we intended.