· 8 min read

GitHub Actions Has a Lockfile Now. One Command Pins Every Action, Including the Ones Your Actions Call. Here Is How I'd Adopt It on a Small Repo.

GitHub's changelog entry dated October 28, 2026 says workflow lockfiles for GitHub Actions are generally available on Free, Team and Enterprise Cloud plans. I missed it until Hugo van Kemenade's November 11 post "Lock your GitHub Actions" made the rounds last week. A CLI extension scans your workflows, pins every action to a commit SHA in a file called .github/workflows/actions.lock, and from then on the locked commit is what runs. That's the thing I've been told to do by hand for years and mostly didn't.

Why tags were the problem

uses: actions/checkout@v6 looks like a version. It's a tag, and tags can be moved. When tj-actions/changed-files was compromised in March 2025, the attacker repointed existing version tags at a malicious commit, and every workflow that referenced a tag ran the new code on its next build, with access to that repo's secrets.

The standard advice afterwards was to pin each action to a full 40-character SHA. It works, and it's miserable to maintain. The SHAs are unreadable, updates are noisy, and it does nothing about the actions that your actions call internally. On a side project with three workflows I'd do it once and never touch it again, which isn't maintenance.

What the lockfile does

GitHub's concept doc says a workflow dependency lockfile pins a commit SHA to every action, including transitive dependencies, and every reusable workflow your workflows depend on. For each dependency it records the ref you asked for, the commit it resolved to, and the numeric owner and repository IDs. GitHub uses those IDs at run time to confirm the repository behind the name is still the one you locked, which covers the case where a repo is deleted and someone else registers the name.

Once a workflow is onboarded, every action it uses has to be in the lockfile, and a ref like main or v3 is trusted from the lockfile and isn't re-resolved on a normal run. The docs go as far as saying that for repositories with a lockfile, SHA pinning inside workflow files is no longer necessary. Hugo's post converts his workflows back to readable @vX.Y.Z tags for that reason.

There's one gap worth knowing. Transitive dependencies are covered except for the dependencies of reusable workflow calls. A reusable workflow is covered by the lockfile of the repository where it's defined, so if you call someone else's reusable workflow, their locking discipline is part of yours.

The setup I'd use

Install the extension and generate the file:

gh extension install github/gh-actions-lock
gh actions-lock

The second command scans everything under .github/workflows/, resolves each action, and writes the lockfile. It also rewrites uses: refs to the resolved version, so @v3 may become @v3.1.0. Read the diff before you commit it. The file is machine-generated and the docs say never to edit it by hand.

Then make CI fail when the lockfile is stale. Hugo pins the extension version in CI, which I'd copy:

- name: Verify actions lockfile
  run: |
    gh extension install github/gh-actions-lock --pin v0.4.1
    gh actions-lock --verify
  env:
    GH_TOKEN: ${{ github.token }}

For a pre-commit hook there's an offline check that needs no authentication, with the trade-off that it doesn't re-verify pins against GitHub:

gh actions-lock --verify-local --no-fix

When an upstream ref moves and you've confirmed the move is legitimate, gh actions-lock --relock re-resolves it. If a locked commit was force-pushed away or deleted, --relock --accept-moved accepts the change. I'd treat needing that second flag as a reason to go read the upstream repo's recent history first.

Updates and enforcement

Dependabot handles the update side. When it opens a version update for an action in an onboarded workflow, it regenerates the matching lockfile entry in the same pull request. It won't onboard a workflow for you, so the first gh actions-lock run is yours. Hugo says Renovate supports lockfiles too, and that zizmor 1.32.0 is the first version of that linter to understand them. Older versions will keep telling you to hash-pin.

There's also a "Require lockfile" policy that blocks runs of workflows that use actions but aren't onboarded. For a solo repo I'd turn it on once everything passes, mostly to stop future me from adding a workflow and forgetting to lock it. GitHub suggests putting the lockfile under CODEOWNERS with a required review. On a one-person repo that's just a reminder to read the diff.

The caveats

The first is a documentation mismatch. The changelog says generally available and lists Free and Team plans. The docs pages I read still say lockfiles are in public preview and subject to change, and their "who can use this" note lists only Enterprise Cloud. The lockfile format version even differs between the docs example and Hugo's post. I'd read that as a feature that shipped faster than its docs, and I'd expect small changes. Nothing I read mentions GitHub Enterprise Server.

The second is the one GitHub states itself: a lockfile protects against unexpected changes, and it doesn't tell you whether a dependency is safe. Locking pins whatever the tag points to at the moment you run the command. If the action was already compromised that morning, you've pinned the compromise.

Third, none of the pages say anything about container images referenced in workflows. I'd assume those are still on you.

Where I could be wrong

I'm recommending adoption partly on the strength of one blog post and docs that still carry a preview banner. If the format changes, you'll regenerate the file, which is a small cost. The bigger risk is false comfort. A lockfile handles the repointed-tag attack. It doesn't handle a malicious release you update to on purpose because Dependabot opened a pull request and you clicked merge. The lockfile makes that review possible by putting the new commit in a diff, and you still have to do it.

What I'd actually do

On every repo with a deploy workflow or a publish-to-npm workflow, run the two commands this week, commit the lockfile, add the verify step to CI and switch the workflow files back to readable version tags. That's ten minutes per repo. For repos whose workflows only run tests with no secrets, I'd do it the next time I'm in there. Hand-pinning never survived on my side projects. A single command and a CI check might.

Author

Sources

Newsletter

The week, in one email.

The weekly summary of what happened and what it means for people who build alone. No spam, unsubscribe any time.

Form not showing? Subscribe on this page instead.

Related Posts