AI & Machine Learning CI/CD & Automation

GitHub Actions workflow lockfiles: onboard shared CI first

GitHub Actions workflow lockfiles reached general availability on October 28, following gh-actions-lock v0.3.0 on October 22, 2026, and v0.4.0 on October 23, 2026. The first rollout decision should be which shared-workflow repositories to onboard. A caller’s lockfile does not cover a reusable workflow’s internal action dependencies, and GitHub’s Require lockfile policy can block the caller when that reusable workflow is not onboarded in its defining repository.

For organizations with centralized CI, that creates a dependency-ordering problem. Onboard shared workflows first, pin their callers to reviewed workflow commits, then expand enforcement into application repositories. Reversing that sequence can turn a supply-chain control into a production deployment outage even when application teams have generated their own lockfiles correctly.

How GitHub Actions workflow lockfiles resolve dependencies

GitHub’s concept documentation places the generated file at .github/workflows/actions.lock. Its workflows section associates onboarded workflows with dependencies. Dependency records include ref, commit, owner_id, and repo_id. The numeric identities help detect replacement of a repository behind a familiar owner and repository name.

Coverage includes direct actions and transitive action dependencies. That extends beyond manually SHA-pinning each visible steps[*].uses entry: an action can invoke other actions, and those dependencies also need controlled resolution. Runtime validation requires the locked commit to remain reachable from the recorded tag or branch in the action’s repository. A commit that exists only in a fork is insufficient.

The release history makes migration review necessary. Version v0.3.0 retained schema v0.0.3 while tightening validation, so a lockfile accepted by v0.2.0 can fail with the newer verifier. Local ./ actions that invoke remote actions became blocking findings by default; fork-only commits are rejected; incomplete dependency graphs can require regeneration with --relock. An unchanged schema version does not guarantee unchanged acceptance behavior.

Palo Alto Networks Unit 42 investigated the March 2025 tj-actions/changed-files compromise, detected on March 14, 2025. Its report describes retargeted tags, runner-memory secrets printed into workflow logs, and a chain involving reviewdog/action-setup and tj-actions/eslint-changed-files. The action was used by more than 23,000 repositories. That adoption figure does not establish how many repositories lost secrets. The incident illustrates mutable-reference and transitive exposure without establishing that lockfiles would have prevented every stage.

Pin reusable workflows separately

Separate two syntactically similar dependency edges. Step-level jobs.<job_id>.steps[*].uses invokes an action. Job-level jobs.<job_id>.uses invokes a reusable workflow. Lockfiles cover action dependencies; they do not pin reusable-workflow references.

Consider an application repository calling a reusable deployment workflow in a central CI repository. The application’s lockfile covers its onboarded action dependencies. The central repository’s lockfile covers actions inside the reusable deployment workflow. The application must independently pin the workflow call to a full commit SHA. These controls protect separate edges in the execution graph.

Replace the placeholder in this reusable-workflow call with a reviewed full commit SHA before using it:

jobs:
  deploy:
    uses: example-org/shared-ci/.github/workflows/deploy.yml@REPLACE_WITH_FULL_COMMIT_SHA

Inventory job-level workflow calls before generating caller lockfiles. Identify the defining repository, its maintainers, the referenced workflow commit, and any further reusable-workflow calls. Onboard the central workflows and verify their action graphs before updating application callers to reviewed commits containing that onboarding.

GitHub’s policy documentation says Require lockfile blocks a calling workflow when a called reusable workflow is not onboarded in its own repository. Therefore, an application-only pilot cannot prove readiness for organization-wide enforcement. Include the shared CI repositories in the pilot’s dependency closure, especially deployment workflows that many callers depend on.

Generate GitHub Actions workflow lockfiles in a bounded pilot

Start with explicitly selected repositories and workflow paths. In an authenticated checkout, install the version being evaluated and generate the lockfile for a selected workflow:

gh extension install github/gh-actions-lock --pin v0.4.0
gh actions-lock .github/workflows/ci.yml

Record the installed extension version in the migration change. At the research cutoff of October 30, 2026, v0.4.0 was the latest listed release. Review both workflow edits and actions.lock; generate the file with the extension rather than editing it manually. The tool can narrow a major-version reference to a specific release tag without changing the resolved commit, so a textual workflow change does not necessarily indicate a dependency update.

Check existing allowed-action rules during this review. Rules expressed using tags may stop matching after onboarding because policy checks use locked SHAs. Adapt the intended rules deliberately. Broadening an allowlist just to make onboarding pass weakens a separate control and conceals the actual migration requirement.

Migrate local composite actions

A local ./ action executes workspace content. Checkout operations and scripts can change that content, so it does not have the same execution semantics as an action fixed to the workflow’s commit. This becomes consequential when a local composite action invokes remote actions that need discovery and locking.

Where appropriate, use the migration option on the selected workflow:

gh actions-lock .github/workflows/ci.yml --migrate-local-actions

The migration converts same-repository references to $/, which executes at the workflow’s commit and allows discovery of action dependencies. Review whether a workflow intentionally depends on generated or modified workspace action code before accepting that semantic change. If you use --ignore-local-actions, record the exception and the remaining coverage gap.

Two stone structural bays have independent steel anchors and a separately bolted connecting bridge.

Pin reusable-workflow calls separately; their internal action dependencies belong to the defining repository.

GitHub documents that an uncovered dependency inside a local action can fail only when execution reaches that step. Earlier steps may already have run. Treat coverage failures as potentially partial executions when reviewing deployment side effects; do not assume every missing dependency is rejected before any work begins.

Validate actions.lock in pull requests

Add read-only verification before enabling policy enforcement. The project’s example uses pull requests and pushes to main, grants contents: read, supplies GH_TOKEN from github.token, and disables checkout credential persistence. At the research cutoff, that example still installed v0.2.0. Update the version intentionally and test the stricter validation behavior.

For the read-only verification workflow below, replace the checkout placeholder with a reviewed full commit SHA:

name: Verify action lockfile
on:
  pull_request:
  push:
    branches: [main]

permissions:
  contents: read

jobs:
  verify:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@REPLACE_WITH_FULL_COMMIT_SHA
        with:
          persist-credentials: false
      - name: Install verifier
        env:
          GH_TOKEN: ${{ github.token }}
        run: gh extension install github/gh-actions-lock --pin v0.4.0
      - name: Verify locks
        env:
          GH_TOKEN: ${{ github.token }}
        run: gh actions-lock --verify

Onboard the verifier workflow itself after adding it. --verify performs network-backed checks without modifying files. --verify-local provides an offline coverage check but does not establish provenance. Keeping verification read-only separates detection from dependency changes, which should arrive as reviewable diffs.

Handle moved references

Preserving a pin and accepting a new dependency commit are different operations. Branches and partial versions retain their locked commits when upstream advances; --relock deliberately advances them. A moved full-version tag produces a verification error. Rewritten history that removes the locked commit from the reference’s ancestry is a separate condition. Do not automate --accept-moved as a general repair step.

Dependabot updates the matching lockfile entry alongside action-version changes for already-onboarded workflows. It does not onboard new workflows. Require lockfile-change review through CODEOWNERS and protected-branch or ruleset approval requirements. Review the selected commit as well as the dependency name: the project README documents that changing a floating reference’s lock entry to an older commit within its history is not detected.

Diagnose verification failures

The troubleshooting guide defines exit 0 as no remaining errors, exit 1 as blocking findings, and exit 2 as tool or configuration failure, including rejected authentication. Warnings do not change a successful exit code. Route dependency findings and authentication failures to different remediation paths rather than regenerating the lockfile for every nonzero result.

Network or rate-limit failures can produce retryable verification errors; the documented CI retry period is approximately two minutes. The research did not establish representative measurements of normal verification overhead. Measure API-related duration in the pilot before assigning a check timeout or estimating fleet-wide cost.

Stage Require lockfile enforcement

GitHub’s announcement lists lockfiles for GitHub Free, Team, Enterprise Cloud, and Enterprise Cloud with data residency. The extension does not support GitHub Enterprise Server. Policy availability needs separate evaluation: the enforcement guide labels its availability Enterprise Cloud and reserves Evaluate mode for Enterprise Cloud. Do not assume identical enforcement controls across all four announced plans.

On Enterprise Cloud, use Evaluate mode and Policy insights before Active enforcement. Resolve shared-workflow coverage first, then inspect findings for the selected application repositories. Active Require lockfile blocks every targeted workflow that is not onboarded, including workflows containing only run steps. Inventory operational workflows as well as the main CI and release paths.

Keep pull-request verification after enforcement so contributors receive earlier feedback. The separate full-length-SHA policy can remain enabled: onboarded lockfiles satisfy it for covered dependencies. Reusable-workflow calls still need their independent full-SHA references.

Before widening enforcement, use a disposable fixture containing a remote composite action, a local composite action, and an external reusable workflow. The tests below have not been executed as part of this research:

  • Add an action without regenerating the lockfile and record the coverage finding.
  • Advance a branch while leaving the locked commit reachable, then separately move an exact release tag.
  • Migrate the local action and inspect the discovered transitive dependencies.
  • Evaluate a caller whose reusable workflow is not onboarded in its defining repository.
  • Exercise a Dependabot update and review the workflow and lockfile changes together.

Record exit codes, changed dependency entries, policy behavior, and API-related duration. These observations distinguish a dependency-resolution failure from an enforcement-scope error or an unavailable API.

Limits of workflow lockfile protection

Locking adds a generated file and a network-backed verification check, while GitHub explicitly says it does not establish that a dependency is safe. Lockfiles do not control secrets, input parameters, runner images, or container images. Mutable container images can generate warnings rather than failures. The verifier’s extension version and the workflow that installs it also remain review responsibilities.

The benefit is controlled action resolution, including transitive dependencies, with explicit update diffs and repository-identity checks. It is useful alongside dependency assessment, least-privilege credentials, and independent image pinning. Defer Active enforcement where the shared-workflow dependency graph is still unowned or incompletely onboarded; continue bounded generation and verification while that prerequisite is resolved.

Metal assemblies at different stages of completion line a sunlit cream inspection bench.

Roll out enforcement in stages, retain verification, and keep human review central.

Before activating a production caller, check the exact reusable-workflow SHA it invokes, confirm that revision is onboarded in its defining repository, and verify the caller’s own workflow coverage. A green application lockfile check alone does not establish readiness for Require lockfile.