Repository navigation
Lock the workflow actions with a lockfile instead of SHA pins - #65
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
@v7can berepointed 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 bygh actions-lockv0.4.1, which records for each action its releasetag, 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 theform 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
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.
gh actions-lockand checked withgh 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.