# Your SHA pin stops one layer down. GitHub's lockfile doesn't.

- Published: 2026-10-29
- Updated: 2026-11-26
- Tags: GitHub Actions, Security, Tooling
- URL: https://devtrillo.com/writing/github-actions-lockfiles/

On March 14, 2025, someone rewrote multiple version tags of `tj-actions/changed-files` to point at one commit, `0e58ed8`. For about a day, any workflow that referenced one of those tags ran that commit. It dumped the runner's memory into the build log, secrets included, and on a public repo the build log is public. [The advisory](https://github.com/advisories/GHSA-mrrh-fwg8-r2c3) (CVE-2025-30066) counts more than 23,000 repositories using the action.

The advice afterwards was to pin every action to a full commit SHA. That helps less than it sounds. [CISA's alert](https://www.cisa.gov/news-events/alerts/2025/03/18/supply-chain-compromise-third-party-github-action-cve-2025-30066) says the attack potentially started with an earlier compromise of `reviewdog/action-setup@v1`, and [reviewdog's advisory](https://github.com/advisories/GHSA-qmg3-hpqr-gqvc) says other reviewdog actions that used it "would also be compromised, regardless of version or pinning method".

On October 14, 2026, GitHub put [workflow lockfiles](https://github.blog/changelog/2026-10-14-github-actions-workflow-lockfiles-in-public-preview) into public preview. I ran it on a copy of this blog's workflows and on a throwaway public repo. It pins the layers a hand pin can't reach, and the runner enforces it with no policy turned on. It also left one `uses:` line completely unpinned.

_Already know this? Jump to [What I'd set up](https://devtrillo.com/writing/github-actions-lockfiles/#what-id-set-up)._

## A SHA pin stops one layer down

**Quiz:** Your workflow uses cli/gh-extension-precompile, a composite action that itself uses actions/setup-go. You pin the precompile line to a full SHA. Is setup-go pinned?

- Yes, a SHA pin freezes everything below it
- Only if precompile pins it by SHA itself
- No, composite actions can't be pinned

**Answer:** Only if precompile pins it by SHA itself — Your pin freezes the composite's own files. Its uses: lines say whatever its authors wrote, and if those are tags, they still float.

A composite action is a list of steps, and those steps have `uses:` lines of their own. You never see them in your workflow. Here's what the lockfile tool found under that one precompile line:

```text title="gh actions-lock on a workflow using cli/gh-extension-precompile@v2"
Pinned 2 actions (+ 3 transitive) across 1 workflow
Transitive dependencies (from composite actions):
  actions/setup-go@4a36011 via cli/gh-extension-precompile@v2.2.0
  actions/attest-build-provenance@a2bbfa2 via cli/gh-extension-precompile@v2.2.0
  actions/attest@59d8942 via actions/attest-build-provenance@a2bbfa25…
```

Three actions you didn't write a line for, three levels deep. That's the reviewdog shape: the hole was in an action other actions used.

**What a SHA pin reaches, and what the lockfile reaches.** The release workflow uses cli/gh-extension-precompile, and that one line is the only thing a hand SHA pin freezes. The precompile composite action uses actions/setup-go and actions/attest-build-provenance, and attest-build-provenance in turn uses actions/attest. Those three transitive actions are referenced by whatever their authors wrote, usually a tag. actions.lock records all four, including the three transitive ones.

## What the lockfile records

The tool is a gh CLI extension. With no arguments it onboards every workflow in `.github/workflows`. Pass a path to onboard just one:

```bash title="install and onboard"
gh extension install github/gh-actions-lock
gh actions-lock
```

The sandbox repo had a CI workflow with an in-repo composite action, a release workflow using precompile, and a workflow that calls a reusable one. The first run:

```text title="first run"
Scanning 3 workflows
Migrated 1 local action to `$/…`
Pinned 3 actions (+ 3 transitive) across 2 workflows
  actions/checkout@v4.4.0 (11d5960)
  actions/setup-node@v4.4.0 (49933ea)
  cli/gh-extension-precompile@v2.2.0 (76961aa)
Transitive dependencies (from composite actions):
  actions/setup-go@4a36011 via cli/gh-extension-precompile@v2.2.0
  actions/attest-build-provenance@a2bbfa2 via cli/gh-extension-precompile@v2.2.0
  actions/attest@59d8942 via actions/attest-build-provenance@a2bbfa25…
```

It writes one file, `.github/workflows/actions.lock`, and it edits your workflows too:

**What gh actions-lock changes in a workflow file**

Before:

```yaml
steps:
  - uses: actions/checkout@v4
  - uses: ./.github/actions/setup-runtime
```

After:

```yaml
steps:
  - uses: actions/checkout@v4.4.0
  - uses: $/.github/actions/setup-runtime
```

`@v4` gets narrowed to the highest full version tag under it. `./` becomes `$/`, which means "this repo, at the commit that's running", so local actions are pinned by definition and need no entry. On a copy of this blog's six workflows, that rewrite changed 7 files.

The lockfile itself is YAML: a list of actions per workflow, then one entry per action.

```yaml title=".github/workflows/actions.lock (excerpt)"
version: "v0.0.3"
workflows:
  ".github/workflows/release-demo.yml":
    - "actions/checkout@v4.4.0"
    - "cli/gh-extension-precompile@v2.2.0"
dependencies:
  "cli/gh-extension-precompile@v2.2.0":
    ref: "v2.2.0"
    commit: "sha1-76961aa3bd1123d0a6fd42d0a41aca0696937c39"
    owner_id: 59704711
    repo_id: 421583656
    uses:
      - "actions/attest-build-provenance@a2bbfa25375fe432b6a289bc6b6cd05ecd0c4c32"
      - "actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c"
```

The `uses:` list under the composite is the part a hand pin can't give you. The numeric `owner_id` and `repo_id` let the runner catch a repo that was renamed or transferred. According to the README, each run checks those IDs, that the commit still exists, and that it's in the history of the recorded tag.

The file is machine-generated, so don't edit it by hand. The [docs](https://docs.github.com/actions/concepts/security/workflow-dependency-lockfiles) go as far as "For repositories using a lockfile, SHA pinning in workflow files is no longer necessary." It's [build the artifact once](/writing/continuous-delivery-2-the-pipeline/#build-the-artifact-once), applied to the pipeline's own dependencies.

## The runner enforces it with no policy on

I expected the lockfile to be something a CI check reads. The hosted runner reads it too. The "Set up job" log of the first run after onboarding:

```text title="Set up job"
Using locked action versions from the workflow's lockfile
Download action repository 'actions/checkout@v4.4.0' (SHA:11d5960a326750d5838078e36cf38b85af677262)
Download action repository 'actions/setup-node@v4.4.0' (SHA:49933ea5288caeca8642d1e84afbd3f7d6820020)
```

Then I opened a PR that added a `uses: actions/upload-artifact@v4` step and didn't relock. The CI workflow didn't fail. It never started. The run ended in `startup_failure` after 0 seconds, and the run page had one annotation:

```text title="annotation on the run"
Invalid lockfile: .github/workflows/actions.lock#L1 — The lockfile could not be
validated. Regenerate it by running `gh actions-lock`.
```

No "Require lockfile" policy was set. Onboarding a workflow is enough for the runner to refuse an action the lockfile doesn't cover.

Next I hand-edited the checkout entry's `commit:` to a different real checkout commit, one that isn't in `v4.4.0`'s history. Every job using checkout stopped in "Set up job":

```text title="Set up job"
Using locked action versions from the workflow's lockfile
##[error]Lockfile pin 3d3c42e5aac5ba805825da76410c181273ba90b1 for `actions/checkout` does not match ref `v4.4.0`. Ensure the pinned commit exists on the expected branch or tag
```

That's the lockfile side moving. The tj-actions case is the other side: the tag moves and your file doesn't.

**An upstream tag is moved; a tag reference follows it, a lockfile pin does not** (Upstream tag `v44.5.1`). Two workflow lines: `uses: tj-actions/changed-files@v44.5.1` and `actions.lock → commit: sha1-…reviewed`.

- **where you reviewed it.** The tag points at the commit you reviewed. The tag reference: runs the commit you reviewed. The lockfile pin: runs the commit you reviewed. **Both lines agree today.** A tag and a pin point at the same commit right up until someone moves the tag.
- **tag moved forward.** The tag now points at a new commit built on top of the one you reviewed. The tag reference: follows the tag, runs the new commit. The lockfile pin: pin stays put, still runs the commit you reviewed. **The run passes on the old code.** The pinned commit is still in the tag's history, so the runner accepts it and nothing warns you. The next relock adopts the new commit, and the lockfile diff is the only place it shows.
- **tag rewritten.** The tag now points at an unrelated commit. The tag reference: follows the tag, runs the unrelated commit. The lockfile pin: pin stays put, run blocked in Set up job. **The tag moved. The pin didn't.** The plain reference picks up whatever the tag points at now. The lockfile still names the old commit, and the runner refuses a pin that isn't in the tag's history.

So I rewrote a tag. In the sandbox I locked a small composite action at a tag, `lab-v1`, then force-pushed the tag to a commit on an orphan branch, one with no shared history. The job stopped in "Set up job". Nothing downloaded and no action code ran:

```text title="Set up job"
Using locked action versions from the workflow's lockfile
Getting action download info
##[error]Lockfile pin 372dc137821543a9343f926311ba63e52a34cc3d for `devtrillo/actions-lock-lab` does not match ref `lab-v1`. Ensure the pinned commit exists on the expected branch or tag
```

Locally, `gh actions-lock --verify` exited 1 with "Pinned commit not in upstream history" and told me to check it, then run `gh actions-lock --accept-moved`.

Then I moved the tag forward instead, to a new commit built on top of the one I had locked. That run went green, and it ran the old locked code, not the new commit. `--verify` passed with no warning. The runner checks that the pinned commit is still in the tag's history, not that the tag still points at it. So a tag that moves forward does nothing to you until you relock, and then it does everything: `gh actions-lock --relock` moved the pin to the new commit without a word. The lockfile diff in that PR is the only place you would see it.

A workflow that isn't in the lockfile gets none of this. I added one with `actions/checkout@v4`, left it out, and it ran green, resolving the tag like it always has. There was no "Using locked action versions" line in its log.

## Reusable workflows are locked somewhere else

The sandbox had a workflow that calls a reusable workflow from another repo:

```yaml title=".github/workflows/reusable-demo.yml"
jobs:
  provenance:
    uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.1.0
```

After onboarding, `--verify` said "All 1 workflow valid". Here's its entry in the lockfile:

```yaml title=".github/workflows/actions.lock"
".github/workflows/reusable-demo.yml": []
```

Empty. `v2.1.0` isn't recorded anywhere in the file. The changelog's one-line summary mentions reusable workflows, which is easy to read as "your lockfile pins them". The concepts doc is more exact: "A reusable workflow is covered by the lockfile of the repository where it's defined."

**Quiz:** Your repo's own reusable workflow at .github/workflows/build.yml is called by another repo with @v1. Whose lockfile protects the actions inside build.yml?

- The caller's, since it's the one running it
- Yours, because build.yml is defined in your repo
- Neither, reusable workflows can't be locked

**Answer:** Yours, because build.yml is defined in your repo — The defining repo's lockfile covers a reusable workflow. That's why the docs suggest onboarding shared-workflow repos first: every caller depends on it.

If you own the shared workflows, onboard that repo first. If you call someone else's, like the slsa one above, that `@v2.1.0` floats exactly as it did before, and whether the steps inside are locked is up to its maintainers.

## Keep it honest in CI

The runner's `startup_failure` blocks the bad run, but its message doesn't name the action. A verify job does. The docs recommend a dedicated workflow that runs when workflows or actions change, set as a required check:

```yaml title=".github/workflows/lockfile.yml"
name: lockfile
on:
  pull_request:
    paths: [".github/workflows/**", "**/action.yml", "**/action.yaml"]
  push:
    branches: [main]
    paths: [".github/workflows/**", "**/action.yml", "**/action.yaml"]
permissions:
  contents: read
jobs:
  verify:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4.4.0
      - run: gh extension install github/gh-actions-lock
        env:
          GH_TOKEN: ${{ github.token }}
      - run: gh actions-lock --verify
        env:
          GH_TOKEN: ${{ github.token }}
```

It uses checkout too, so onboard it like the others. The default `GITHUB_TOKEN` with `contents: read` was enough, since every action involved is public. On the stale-lockfile PR it said:

```text title="lockfile / verify"
Scanning 4 workflows
1 of 4 workflows failed
✗ Not pinned actions/upload-artifact@v4
  used in workflow but not pinned in lockfile (actions/upload-artifact@v4)
  ↳ .github/workflows/ci.yml
Re-run without --verify to apply fixes.
```

`--verify` never writes. The fix is to run plain `gh actions-lock` on the branch and commit the result, which pinned `actions/upload-artifact@v4.6.2` and turned both checks green. For a pre-commit hook there's `--verify-local`, which works offline and only checks that every action has an entry.

## Dependabot keeps it current, mostly

The docs say to enable Dependabot before you create the lockfile. I pushed this to the sandbox:

```yaml title=".github/dependabot.yml"
version: 2
updates:
  - package-ecosystem: "github-actions"
    directories:
      - "/"
      - "/.github/actions/setup-runtime"
    schedule:
      interval: "weekly"
```

My first version had only `directory: "/"`. Fifty seconds after that push, Dependabot opened "bump actions/checkout from 4.4.0 to 7.0.1". It changed every workflow's `uses:` line and the lockfile in the same PR:

```diff title="actions.lock in the Dependabot PR"
-    'actions/checkout@v4.4.0':
-        ref: 'v4.4.0'
-        commit: 'sha1-11d5960a326750d5838078e36cf38b85af677262'
+    'actions/checkout@v7.0.1':
+        ref: 'v7.0.1'
+        commit: 'sha1-3d3c42e5aac5ba805825da76410c181273ba90b1'
         owner_id: 44036562
         repo_id: 197814629
```

The PR body is the usual release notes and doesn't mention the lockfile, so read the diff. A changed `commit:` is what you're approving, and a changed `owner_id` or `repo_id` is a red flag.

Two places it went quiet:

- The composite action. With only `directory: "/"`, Dependabot left the `setup-node@v4.4.0` inside `.github/actions/setup-runtime/action.yml` alone. Listing that directory, as above, got a PR that bumped the composite and the lockfile together.
- A workflow that isn't onboarded. I added `legacy.yml` with `actions/setup-python@v4` and didn't onboard it. Dependabot bumped it to `@v7` and touched nothing else. The docs say Dependabot won't onboard a workflow and reports that onboarding is required. I couldn't find that report in the PR body, its comments, or the job log. The only signal was the verify job going red.

## Four smaller traps

Locking freezes your major. Onboarding narrowed `actions/checkout@v4` to `v4.4.0` while checkout was on `v7.0.1`. It pins what you had and won't upgrade you. The Dependabot PR above is how you move forward.

Tag-pinned allowlists stop matching. If you use "Allow select actions" with entries like `actions/checkout@v4.4.0`, a locked workflow fails at startup, because the runner now checks the SHA:

```text title="startup_failure annotation"
The action actions/checkout@11d5960a326750d5838078e36cf38b85af677262 is not allowed
in devtrillo/actions-lock-lab because all actions must be from a repository owned by
devtrillo or match one of the patterns: actions/checkout@v4.4.0,
actions/setup-node@v4.4.0, actions/upload-artifact@v4.6.2.
```

A full SHA or a wildcard like `actions/setup-node@*` in the allowlist fixed it.

Require lockfile is hard to reach on Free. It's the policy that blocks workflows that aren't onboarded, and it has an Evaluate mode and an Active mode. Evaluate is GitHub Enterprise only. Trying to create an Evaluate-mode policy through the API said so plainly: "Enforcement evaluate option is not supported on this plan. Please upgrade to Enterprise to enable it." The API also has no lockfile rule type to ask for. I didn't check the Settings UI, so I haven't tested Active mode. What did work was the repo setting "Require actions to be pinned to a full-length commit SHA". With it on, the onboarded workflow, still written as `@v4.4.0`, ran fine, because the lockfile counts as the pin. The workflow that wasn't onboarded was blocked:

```text title="not onboarded, SHA pinning required"
##[error]The action actions/checkout@v4 is not allowed in devtrillo/actions-lock-lab
because all actions must be pinned to a full-length commit SHA.
```

Last, it's a preview. The extension is v0.2.0, the format and flags may change before 1.0, and GitHub Enterprise Server isn't supported.

## Locking isn't vetting

The changelog says it outright: locking doesn't check that a dependency is safe. If you run `gh actions-lock` while a tag points at a malicious commit, you've pinned the malicious commit, and the runner will defend it from then on. A SHA also says nothing about what an action downloads while it runs, a point people raised in [the preview feedback discussion](https://github.com/orgs/community/discussions/194494).

Relocking is locking again. If a tag moved forward onto bad code since your last lock, `--relock` pins that code and says nothing. So review before you lock, and treat every `commit:` change in `actions.lock` as code review.

## What I'd set up

In this order, on a repo you own:

1. `.github/dependabot.yml` for `github-actions`, with every composite action's directory listed.
2. `gh actions-lock`, then review the `uses:` rewrites and the lockfile, and commit both.
3. The `lockfile.yml` verify workflow above, as a required check.
4. "Require actions to be pinned to a full-length commit SHA", so a new workflow that nobody onboarded can't run on tags. That's the stand-in for Require lockfile until you can turn the real policy on.
5. Onboard any repo that holds shared reusable workflows, since callers can't lock them for you.

> **Tip:** Before you trust the setup, break it on purpose: add a `uses:` line without
> relocking and push. The verify job should go red and the workflow should
> refuse to start.

A hand pin freezes the line you can read. The lockfile freezes the lines under it too, and the runner checks them every time. It still can't tell you whether the commit you pinned was a good one.
