Help us shape the future of Go! Take the 2026 Go Developer Survey

gh-actions-lock

module
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2026 License: MIT

README

gh-actions-lock

[!WARNING] Public preview. gh-actions-lock is pre-1.0. The lockfile format, flags, and behavior may change between releases.

A GitHub CLI extension that pins every direct and transitive action your workflows use to a verified commit, recorded in .github/workflows/actions.lock.

Install

Requires an authenticated gh. github.com and GitHub Enterprise Cloud with data residency (*.ghe.com) are supported; GitHub Enterprise Server is not.

gh extension install github/gh-actions-lock

To teach your AI coding agent the CLI:

gh skill install github/gh-actions-lock

Quickstart

From the repository checkout:

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

Rerun gh actions-lock after adding a workflow or changing any uses:.

Make sure you don't check in a corrupt lockfile. Copy .github/workflows/verify-lockfile.yml into your repository, modify it for your needs, then run gh actions-lock once so that workflow is locked too.

GitHub Enterprise Cloud with data residency

Run gh auth login --hostname TENANT.ghe.com, then run gh actions-lock from the tenant repository checkout. The host comes from the repository remote; you don't need --hostname or an exported token.

Actions that aren't on the tenant, such as actions/checkout, are read from public github.com repositories. Those lookups never use the tenant token, GH_TOKEN or GITHUB_TOKEN. They use, in order:

  1. GH_ACTIONS_LOCK_GITHUB_COM_TOKEN, a github.com token used only for these lookups.
  2. Your gh auth login --hostname github.com login.
  3. Otherwise they're anonymous and share GitHub's limit of 60 requests an hour per IP address, which a shared proxy or runner pool can exhaust quickly.

In GitHub Actions on GHE.com, the job's GITHUB_TOKEN is issued by your tenant, so github.com doesn't accept it. Create a fine-grained personal access token on github.com with public repository access only and no permissions, save it as a secret on the tenant, and pass it in:

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

Modes

Command Writes Network Use for
gh actions-lock yes yes Onboarding and fixing the lockfile
gh actions-lock --relock yes yes Advancing moved refs (main, v4) to current upstream commits
gh actions-lock --verify no yes CI: the same checks as a fix run
gh actions-lock --verify-local no no Pre-commit: every uses: has a lockfile entry (coverage only, not provenance)
gh actions-lock --no-fix no yes Read-only report

Other flags:

  • <workflow-path>... scopes a run to specific workflows. Only a full-directory run prunes entries for deleted workflows.
  • --json [fields] prints machine-readable output to stdout.
  • --accept-moved accepts pins whose locked commit is no longer upstream. Check why it moved first; never use it in automation.
  • --no-narrow keeps partial versions (v4) as written instead of narrowing to a full tag.

gh actions-lock --help is authoritative.

Limitations

  • Reusable workflows called at jobs.<id>.uses from another repository are not locked (#179).
  • Local ./… actions are never followed or locked, so one that uses remote actions is a blocking error until you pass --migrate-local-actions (rewrites same-repo ./… to $/…) or --ignore-local-actions.
  • Container images are not locked, and any image without an @sha256: digest, including one chosen by a ${{ }} expression, is a warning (#236).
  • --verify-local is an offline coverage check that doesn't verify provenance; --verify checks provenance before merge, and the runner checks it again at job start.
  • A lockfile change that moves a floating ref (v4, main) back to an older commit in its history isn't detected, so review lockfile diffs or pin exact tags.

Learn more

Contributing

See CONTRIBUTING.md

Support

See SUPPORT.md.

License

Licensed under MIT.

Directories

Path Synopsis
cmd
gh-actions-lock command
Command gh-actions-lock scans workflows and pins GitHub Actions to immutable commit SHAs.
Command gh-actions-lock scans workflows and pins GitHub Actions to immutable commit SHAs.
gh-actions-lock/format
Package format renders check reports for the `check` command.
Package format renders check reports for the `check` command.
internal
config
Package config loads the release-cooldown policy for a repository from two sources: the repo's Dependabot config (authoritative) and the user's ~/.config/gh-actions-lock/config.yml (fallback).
Package config loads the release-cooldown policy for a repository from two sources: the repo's Dependabot config (authoritative) and the user's ~/.config/gh-actions-lock/config.yml (fallback).
dep
Package dep defines the working dependency types shared between the resolver and the lockfile.
Package dep defines the working dependency types shared between the resolver and the lockfile.
ghapi
Package ghapi provides a unified GitHub API client that owns both REST and GraphQL connections, retry transport, and profiling instrumentation.
Package ghapi provides a unified GitHub API client that owns both REST and GraphQL connections, retry transport, and profiling instrumentation.
ghapi/httpmock
Package httpmock provides HTTP test fakes for the ghapi client.
Package httpmock provides HTTP test fakes for the ghapi client.
lockfile
Package lockfile manages CLI lockfile state: loading, saving, and converting the on-disk format.
Package lockfile manages CLI lockfile state: loading, saving, and converting the on-disk format.
pin
Package pin implements the two-phase pin lifecycle: Plan builds a complete Record of what to pin (pure computation + network reads), and Commit writes the Record to disk (workflow files + lockfile).
Package pin implements the two-phase pin lifecycle: Plan builds a complete Record of what to pin (pure computation + network reads), and Commit writes the Record to disk (workflow files + lockfile).
pinpool
Package pinpool is a small generic worker pool with a Reporter hook for per-slot UI status.
Package pinpool is a small generic worker pool with a Reporter hook for per-slot UI status.
pipeline
Package pipeline orchestrates the scan, resolve, check, and report flow for a single run.
Package pipeline orchestrates the scan, resolve, check, and report flow for a single run.
pipeline/checks
Package checks implements the structural, misleading-sha, and resolver-bound validators run against parsed workflows.
Package checks implements the structural, misleading-sha, and resolver-bound validators run against parsed workflows.
profile
Package profile captures phase timing, CPU profiles, and HTTP round-trip logs for performance analysis.
Package profile captures phase timing, CPU profiles, and HTTP round-trip logs for performance analysis.
resolve
Package resolve resolves action refs to commit SHAs, recursively discovers transitive dependencies, and verifies commit reachability.
Package resolve resolves action refs to commit SHAs, recursively discovers transitive dependencies, and verifies commit reachability.
syncmap
Package syncmap provides a simple generic mutex-guarded map.
Package syncmap provides a simple generic mutex-guarded map.
tag
Package tag lists tags and classifies versions.
Package tag lists tags and classifies versions.
ui
Package ui provides terminal-aware output formatting for gh-actions-lock.
Package ui provides terminal-aware output formatting for gh-actions-lock.
uses
Package uses classifies `uses:` values, so every caller decides what a value is the same way and an unparseable reference can't be mistaken for one that is deliberately not a repository action.
Package uses classifies `uses:` values, so every caller decides what a value is the same way and an unparseable reference can't be mistaken for one that is deliberately not a repository action.
workflowfile
Package workflowfile owns the parsed workflow YAML representation: loading, extraction of action refs, local composite discovery, and comment-preserving rewriting.
Package workflowfile owns the parsed workflow YAML representation: loading, extraction of action refs, local composite discovery, and comment-preserving rewriting.
test
scenarios
Package scenarios provides a shared scenario catalog consumable by both Go tests and the Ruby integration harness.
Package scenarios provides a shared scenario catalog consumable by both Go tests and the Ruby integration harness.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL