Most of us write uses: some-org/some-action@v3 and never think about it again. That tag feels like a version number. It isn't. A tag is a pointer, and anyone with write access to that repository, or anyone who has stolen that access, can move it to different code. Your workflow file doesn't change, your pull request history looks clean, and the next CI run executes something you never reviewed.
GitHub's answer arrived on October 14: workflow lockfiles for GitHub Actions, now in public preview. It's the feature I've been asking for ever since "we pinned to v2" became a sentence that sounds safer than it is. Here's how it works and how I'd adopt it without breaking a busy repository.
The problem lockfiles solve
GitHub puts it plainly in its changelog: tags and branches can move after you review a workflow, so a later run might execute different code. If an action is compromised, a moved tag or branch can introduce malicious code into your workflow without any change to your repository.
The traditional fix has been pinning every uses: line to a full commit SHA. That works, but it's ugly, hard to review, and it doesn't cover the actions that your actions call. Composite actions and reusable workflows can pull in their own dependencies, and those stay unpinned unless their authors pinned them too.
Lockfiles let you keep readable references like @v3 in your workflow while GitHub runs the exact commits you locked. It's the same idea as package-lock.json or Cargo.lock, applied to CI.
How it works
You install the gh actions-lock extension for the GitHub CLI from GitHub's public gh-actions-lock repository. According to the changelog, the extension lets you:
-
Pin your dependencies. It generates
.github/workflows/actions.lockwith reviewable commits for your actions and their transitive dependencies, plus reusable workflow dependencies. - Adopt locking gradually. You onboard workflows one at a time. Once a workflow is onboarded, it must have lockfile entries for its dependencies, and Actions runs the recorded commits.
- Keep runs consistent. For an onboarded workflow, Actions requires every dependency to be in the lockfile and uses its recorded commit, even if a tag or branch moves.
- Check for stale lockfiles. You can verify the lockfile is up to date without modifying files, including as a CI check.
The preview is available on GitHub Enterprise Cloud, Enterprise Cloud with data residency, Team and Free plans. GitHub updated the changelog on October 14 to clarify that plan list, so if you read an earlier version that suggested otherwise, it's broader now.
Enforcement: the Require lockfile policy
There's a second piece in preview: a Require lockfile policy. Enterprise, organisation and repository administrators can use it to require workflows to use lockfiles across their enterprise, organisation or repository.
This is what turns lockfiles from a nice habit into a control. Without enforcement, the safest repos adopt it and the riskiest ones don't. With enforcement, a new workflow that skips the lockfile simply won't run its unpinned dependencies.
I wouldn't switch it on across an organisation on day one, though. Start with your most sensitive repositories: the ones that deploy to production, publish packages or hold cloud credentials. Those are exactly the places a moved tag can do the most damage.
Dependabot keeps it from going stale
The worry with any lockfile is that it becomes a reason never to update. GitHub has handled that sensibly. When Dependabot opens a version update for an action in an onboarded workflow, it regenerates the matching lockfile entry in the same pull request. The workflow reference and its locked commit stay in sync without extra configuration.
That's the right design. You review one pull request that shows both the version change and the new commit, and you merge them together. If you don't already run Dependabot for GitHub Actions, this is a good reason to start.
The one thing lockfiles don't do
GitHub is honest about this, and I want to repeat it loudly: locking does not determine whether the dependency itself is safe. If you lock a commit that's already malicious, you've just made sure you run the malicious code every time, consistently.
So the process has to be review, then lock. When you onboard a workflow, look at what each action does and who maintains it. Prefer actions from organisations you trust, with real maintainers and visible history. And when Dependabot proposes a new commit, read the diff for anything that touches secrets, tokens or network calls before you approve.
Lockfiles turn a silent change into a visible one. That's a huge improvement. But someone still has to look.
Lockfiles versus pinning SHAs by hand
If your team already pins every action to a full commit SHA, you might wonder whether this is worth the switch. I think it is, for three reasons.
First, readability. A line like @v3 tells a reviewer what they're looking at. A 40-character hash tells them nothing without a trip to the action's repository. With lockfiles, the human-readable version stays in the workflow and the hash lives in a file built for machines.
Second, depth. Hand-pinning only covers the uses: lines you can see. The changelog says the lockfile also records transitive dependencies and reusable workflow dependencies. That's the layer hand-pinning has always missed, and it's where a compromised dependency can hide.
Third, enforcement. A hand-pinned workflow is safe until someone adds a new step with a bare tag. Once a workflow is onboarded, GitHub requires every dependency to be in the lockfile, and the Require lockfile policy can make that the rule for a whole organisation.
| Tags only | Hand-pinned SHAs | Workflow lockfile | |
|---|---|---|---|
| Readable references | Yes | No | Yes |
| Protects against moved tags | No | Yes, for direct steps | Yes |
| Covers transitive dependencies | No | No | Yes |
| Enforceable by policy | No | No | Yes (Require lockfile) |
| Dependabot updates | Yes | Yes | Yes, lockfile in the same PR |
The one thing hand-pinning has going for it is that it works today without a preview feature. If you're risk-averse about previews, keep your SHAs for now and pilot lockfiles on a single repo alongside them.
How I'd roll this out
Here's the order I'd follow for a team with a few dozen repositories:
- Inventory. List the repositories with workflows that deploy, publish or hold cloud credentials. Those go first.
-
Pilot on one repo. Install the extension, generate
actions.lockfor a single workflow, and review the commits it pins. Run the workflow a few times to make sure nothing breaks. - Add the staleness check to CI. Use the extension's verify mode so pull requests fail if the lockfile is out of date.
- Turn on Dependabot for Actions in the pilot repo and watch how its pull requests look with lockfile updates.
- Expand to the rest of the sensitive repos, then enable the Require lockfile policy for them.
- Roll out organisation-wide once the team is comfortable, and only then consider enforcement everywhere.
None of these steps takes long. The slow part is step two's review, and that's the step you shouldn't rush.
Image: Contributors of github/docs via Wikimedia Commons, CC BY 4.0
Other Actions changes worth catching this month
Lockfiles are the headline, but GitHub's Actions changelog has been busy, and a few items could bite you if you've been ignoring it:
- Node 20 is no longer available in GitHub Actions, as of September 23. Old JavaScript actions that relied on it need updating.
- The macOS 14 runner image is being retired, per an October 1 notice. Move macOS jobs to a newer image.
- The Xcode 27 runner image is generally available as of October 15, which matters if you build for Apple platforms.
- Stateless GitHub App installation tokens rolled out on October 2.
- Actions Runner Controller 0.15.0 was released on October 1 for teams running self-hosted runners on Kubernetes.
If your workflows haven't been touched in a while, a quick pass for these will save you a surprise failure later.
Who helped build it
GitHub credits community members who tested the preview and gave feedback, with special thanks to Andrew Nesbitt, François Proulx, Jesse Houwing and William Woodruff for working closely on the design over the past year. That matters to me. Supply chain tooling designed with people who think about package ecosystems for a living tends to get the details right. Feedback goes to the existing community discussion or as issues in the gh-actions-lock repository.
Should you care?
If your CI deploys anything or touches secrets, yes. Workflow lockfiles close a gap that SHA pinning only half-covered, they handle transitive dependencies and reusable workflows, and Dependabot keeps them current. Start with one sensitive repo this week, review what you lock, add the staleness check, and work outward. Just remember the lock only guarantees you get the code you approved, so make sure you approved the right code.
Frequently Asked Questions
What are GitHub Actions workflow lockfiles?
A lockfile at .github/workflows/actions.lock records the exact commits for your actions, their transitive dependencies and reusable workflows. Onboarded workflows run those commits even if a tag or branch moves.
Which GitHub plans can use workflow lockfiles?
The public preview covers GitHub Enterprise Cloud, Enterprise Cloud with data residency, Team and Free plans.
Does Dependabot work with Actions lockfiles?
Yes. When Dependabot opens a version update for an action in an onboarded workflow, it regenerates the matching lockfile entry in the same pull request.
Do lockfiles make my actions safe?
No. They keep runs tied to the commits you locked, but they don't check whether that code is safe. Review dependencies before locking them.
Originally published on Mango Developer.
Top comments (0)