Skip to content
ToolShedby Wasim Shaikh

GitHub Actions Workflow Lockfiles Are GA: How to Pin Actions with gh actions-lock

Wasim · 2 Nov 2026

What Are Workflow Lockfiles?

On October 28, 2026, GitHub made workflow dependency lockfiles generally available. They were in public preview from October 14.

A lockfile does for GitHub Actions what package-lock.json does for npm. You keep writing readable references like actions/checkout@v4. The lockfile records the exact commit each reference resolved to, and Actions runs that commit. In GitHub's words, it keeps you on "the exact commits you locked, even if those references move."

File .github/workflows/actions.lock
Generated by The gh actions-lock GitHub CLI extension
Plans Enterprise Cloud (including data residency), Team and Free
Not supported GitHub Enterprise Server (per the extension's README)
Enforcement A "Require lockfile" policy at enterprise, organization or repository level

Why This Matters

A tag like @v3 or a branch like @main resolves to whatever commit it points to when the job runs. The lockfile docs spell out the risk: if an upstream maintainer's account is compromised and a tag is moved, your repositories could run malicious code.

The usual fix was to pin every third-party action to a full commit SHA in the workflow file. That works, but it is hard to read and hard to update. The docs now say that for repositories using a lockfile, SHA pinning in workflow files is no longer necessary.

The lockfile pins actions and their transitive dependencies, meaning the actions your actions use. It also stores the source repository's numeric owner_id and repo_id. At run time, Actions uses those IDs to confirm the repository behind a name is still the one you locked.


How to Set It Up

You need an authenticated gh. Install the extension:

gh extension install github/gh-actions-lock

From your repository checkout, generate the lockfile and commit it:

gh actions-lock            # onboard or fix: pin every resolvable action and write actions.lock
git add .github/workflows/ # check into source

Both commands are from the extension's README. Do not hand-edit actions.lock; the file's own header says to regenerate it with gh actions-lock.

You can onboard one workflow at a time. Pass workflow paths to scope a run. Once a workflow is onboarded, every action it uses must have a lockfile entry.

Rerun gh actions-lock whenever you add a workflow or change a uses: line.


The Five Modes

From the README:

Command Writes files Network Use for
gh actions-lock Yes Yes Onboarding and fixing
gh actions-lock --relock Yes Yes Moving main or v4 refs to the current upstream commit
gh actions-lock --verify No Yes CI checks
gh actions-lock --verify-local No No Pre-commit coverage check only
gh actions-lock --no-fix No Yes Read-only report

--verify-local only checks that every uses: has an entry. It does not verify provenance. --verify checks provenance before merge, and the runner checks again when a job starts.


Verify It in CI

The README suggests copying its verify-lockfile.yml workflow into your repo and running gh actions-lock once so that workflow is locked too. The core step is:

gh actions-lock --verify

The enforcement how-to says this verify job "should exit with an error if the lockfile is stale." Make it a required status check.

On a GitHub Enterprise Cloud with data residency (*.ghe.com) tenant, the README gives this step:

- run: gh actions-lock --verify
  env:
    GH_TOKEN: ${{ github.token }}
    GH_ACTIONS_LOCK_GITHUB_COM_TOKEN: ${{ secrets.ACTIONS_LOCK_GITHUB_COM_TOKEN }}

Without a github.com token, public action lookups are anonymous and share a limit of 60 requests per hour per IP address.


Dependabot and the Require Lockfile Policy

When Dependabot opens a version update for an action in an onboarded workflow, it regenerates the matching lockfile entry in the same pull request. GitHub says this needs no extra configuration.

Admins can enforce adoption with the Require lockfile policy. In Active mode it "blocks runs of targeted workflows that include action dependencies but are not onboarded to the repository's lockfile." Evaluate mode, available only on GitHub Enterprise, reports results under Policy insights without blocking. You can scope the policy to specific repositories and workflows.

Start with Evaluate, if you have it, and switch to Active once your main repos are onboarded.


Limitations to Know

From the README and docs:

  • Reusable workflows called from another repository are not locked by your lockfile. They are covered by the lockfile of the repository where they live.
  • Local ./ actions are never followed. A local action that uses remote actions is a blocking error unless you pass --migrate-local-actions or --ignore-local-actions.
  • Container images are not locked. An image without an @sha256: digest produces a warning.
  • Rollbacks are not detected. A lockfile change that moves v4 or main back to an older commit is not flagged. Review lockfile diffs in PRs.
  • --accept-moved accepts pins whose commit is no longer upstream. The README says never to use it in automation.

The biggest caveat is GitHub's own: lockfiles stop unexpected changes, but they do not tell you whether a dependency is safe. Review an action before you lock it.

One more note: when I checked on November 2, the docs page still carried a "public preview" banner, while the changelog says GA. The changelog is the newer source.


Wasim Shaikh

About the author

Wasim Shaikh is a UI/UX developer and front-end engineer with 15+ years of experience, based in Ahmedabad, India. He specializes in Liferay, React, Angular, Next.js and Tailwind CSS.

Keep reading

Web dev · 23 Nov 2026GitHub Event Streams and gh event listen: Stop Polling Pull Requests in Scripts and AI AgentsWeb dev · 23 Nov 2026PostgreSQL 19 Released: REPACK CONCURRENTLY, ON CONFLICT DO SELECT and an Upgrade ChecklistWeb dev · 22 Nov 2026Paper.design vs Figma vs Penpot for Developers