Skip to content

Lock the workflow actions with a lockfile instead of SHA pins - #65

Merged
dimitrivlachos merged 2 commits into
mainfrom
actions-lock
Nov 13, 2026
Merged

dimitrivlachos merged 2 commits into
mainfrom
actions-lock

Conversation

@dimitrivlachos

@dimitrivlachos dimitrivlachos commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

This is the dx2 side of fast-feedback-service #170. In #60 I pinned
every action to a commit SHA, since a tag such as @v7 can be
repointed by whoever controls the action, as happened with tj-actions
and trivy-action, and a SHA cannot. It did trade neat pointers for
ungainly SHAs, and it still left two gaps: a SHA fixes which commit
runs but not whose repository it comes from, and it only reaches our
own workflow files, so an action that calls other actions internally is
only as pinned as its maintainers make it.

GitHub has now released workflow dependency lockfiles, which do the
same job as the SHAs and close both gaps, so this PR moves dx2 over to
them. It adds .github/workflows/actions.lock, generated by
gh actions-lock v0.4.1, which records for each action its release
tag, its commit, and the numeric IDs of the account and repository it
belongs to. Once a workflow is in the lockfile, "the locked commit is
what runs when the workflow executes", a commit that is not reachable
from the recorded tag is rejected when the workflow runs. The 8
actions dx2 uses and the one they pull in transitively are all locked.

With the commit held in the lockfile, the neat pointers come back: the
workflows name exact releases (actions/checkout@v7.0.1), which is the
form the tool writes and keeps. Dependabot needs no new configuration;
when it bumps an action in a locked workflow, it regenerates the
lockfile entry in the same pull request.

Changes

  • Named every action by its exact release tag instead of its commit
    SHA, and updated the Dependabot header, which described it reading
    the version from the trailing comment. Every locked commit is the SHA
    it replaces, so no action changes version.
  • Added the lockfile, generated by gh actions-lock and checked with
    gh actions-lock --verify, which passes on all three workflows.

After this merges, the lockfile can be made mandatory with an
Actions policy. Under Settings -> Actions -> Policies, create a new
policy, set its enforcement status to Active, target this repository's
workflows, and enable the "Require lockfile" protection. A targeted
workflow that is not in the lockfile is then blocked rather than
resolved live.

@dimitrivlachos dimitrivlachos self-assigned this Nov 13, 2026
@dimitrivlachos
dimitrivlachos merged commit c6a470a into main Nov 13, 2026
5 checks passed
@dimitrivlachos
dimitrivlachos deleted the actions-lock branch November 13, 2026 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant