The problem SHA pinning only half solved
Yaml
# the full commit SHA (40 hex characters), then the version as a comment
- uses: actions/checkout@<commit-sha> # v5.1.0
Setting it up on a Symfony CI
Yaml
# .github/workflows/ci.yml
name: CI
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
coverage: none
- run: composer install --no-progress --prefer-dist
- run: vendor/bin/phpstan analyse --no-progress
- run: vendor/bin/phpunit
Bash
gh extension install github/gh-actions-lock
gh actions-lock --version
# Lock every workflow in the repository
gh actions-lock
# Or a single workflow, for gradual adoption
gh actions-lock .github/workflows/ci.yml
git add .github/workflows/
git commit -m "ci: lock GitHub Actions dependencies"
Verify in CI, not only at run time
Yaml
# .github/workflows/verify-actions-lock.yml
name: Verify actions lockfile
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
jobs:
verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Check actions.lock
env:
GH_TOKEN: ${{ github.token }}
run: |
gh extension install github/gh-actions-lock --pin v0.4.0
gh actions-lock --verify
Bash
gh actions-lock .github/workflows/ci.yml
gh actions-lock --verify
Updates: Dependabot and --relock
Yaml
# .github/dependabot.yml
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
Making adoption mandatory
Side note: pull_request_target on December 2
The traps
- The lockfile does not cover everything. According to the summary Anna published on DEV, reusable workflows (called through jobs.<job>.uses) are not locked and still need SHA pinning, Docker images are not locked either (pin them by @sha256: digest, the hash of the image content), local ./ actions are not followed, and a tag moved back to an older commit of its own history is not detected. GitHub Enterprise Server is not supported.
- Locking is not auditing. GitHub says it plainly: the lockfile protects against unexpected changes, not against a dependency that is already malicious when you lock it. Reviewing the action before the first gh actions-lock is still on you.
- The --accept-moved option accepts a moved tag without complaint. It has no place in a script or an automated job, or the lockfile stops serving any purpose.
Sources
- Trying out GitHub Actions workflow lockfiles: pinning dependencies to commits with actions.lock, and stopping before execution if they drift — Classmethod DevelopersIO, Yuji Nishimura, October 16, 2026 (updated November 2, 2026)
- GitHub Actions workflow lockfiles are now GA: Trying out how to prevent missed updates and forgotten onboarding with CI, Dependabot, and policies — Classmethod DevelopersIO, Yuji Nishimura, November 3, 2026
- GitHub Actions has lockfiles now, and pull_request_target gets blocked on Dec 2: 7 workflow changes to catch in review in 2026 — DEV Community, Anna, November 13, 2026
- GitHub Actions workflow lockfiles are generally available — GitHub Changelog, October 28, 2026
- GitHub Actions workflow lockfiles in public preview — GitHub Changelog, October 14, 2026
- pull_request_target blocked by default December 2 — GitHub Changelog, November 2, 2026
- Workflow dependency lockfiles — GitHub Docs
- github/gh-actions-lock — GitHub CLI extension repository
- CVE-2025-30066 (GHSA-mrrh-fwg8-r2c3) — GitHub Advisory Database, tj-actions/changed-files compromise, March 2025