Skip to content

feat(lockfiles): lockfile maintenance relocks moved refs in actions.lock - #305

Merged
sweepies merged 1 commit into
mainfrom
feat/actions-lock-relock
Nov 14, 2026
Merged

sweepies merged 1 commit into
mainfrom
feat/actions-lock-relock

Conversation

@sweepies

@sweepies sweepies commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

In a repository that commits .github/workflows/actions.lock, lockfile maintenance now advances the refs that moved upstream (a floating @v7, or a ref inside a composite action) and lists them in the maintenance PR. This is PR 4 of the actions.lock work, after #300, #302 and #303.

Behaviour change

  • When it runs: maintenance plans an Actions job when the lock exists and the github-actions manager is on.
  • The run: gh-actions-lock --relock over the whole workflow directory, with --no-onboard --no-narrow --ignore-local-actions as always and never --accept-moved or --migrate-local-actions. It uses the same environment, token and masking as the update run.
    • Unlisted workflows are never onboarded or rewritten: with --no-onboard the tool skips workflows that have no lock entry when it writes. A real-tool test with an unlisted workflow confirms this.
    • A whole-directory run also prunes listed workflows that no longer exist.
  • Proof: the regenerated lock must list exactly the base lock's workflows that still exist (a relock may drop only deleted ones), --verify-local passes over that set, and the commit may hold only actions.lock. A relock that rewrites a workflow fails. When every listed workflow is gone, maintenance deletes the lock and the PR says so.
  • Symlinks: a symlinked workflow or action file isn't checked out. The tool's own failure on it is isolated like any other relock failure, and an update touching it is held with the tool's reason.
  • Failures:
    • Retryable (GitHub unreachable or rate-limited): waits for the next run.
    • Any other blocking finding, such as an unreachable-pin in any workflow: fails with the tool's category and detail.
    • A failed relock holds only itself. The other maintenance jobs still publish, and the failure becomes a report warning. If nothing else changed, the branch fails so it retries.
  • The PR body lists each moved ref under its workflow, e.g. "actions/checkout@v7 now resolves to 3d3c42e; the lock had 9c091bb". The list is read from the lock diff, because the tool reports no finding for a ref that moved inside a composite.
  • Fix from feat(actions): actions.lock is regenerated with the update, or the update is held #303: Finding.retryable now defaults to false. The tool omits it when false, so a non-retryable hold read as "unparseable findings".

Tests

  • Real tool through the proxy fixture: a direct actions/checkout@v7, a transitive actions/setup-go@v5 inside cli/[email protected], and a current lock (no change).
  • Driver tests:
    • the flags, environment and token, with no paths;
    • how moved refs are attributed through composites;
    • classification;
    • a rewritten workflow fails;
    • other jobs aren't held, and the tree is restored;
    • the token never appears in a reason.
  • Body rendering (the section appears only when refs moved), planning, and an engine maintenance test whose commit holds only actions.lock.
  • corpus:snapshot is unchanged; one transcript row is added; the state rows are rehashed.

Follow-ups

  • No release-age wait applies to what relock picks up (the tool takes no cutoff).
  • The tool resolves every workflow, listed or not, so a broken ref in an unlisted workflow (a typo, a deleted tag, a private action, an invalid workflow) fails the relock. This is documented; scoping relock to the listed workflows would avoid it, but then the tool wouldn't prune deleted ones.
  • On CLI and Action runs, the relock uses the run's own token (as the update run does, per the decision in feat(github): a repository-scoped, read-only installation token #302 and feat(actions): actions.lock is regenerated with the update, or the update is held #303). Someone who can push to the repository could hand-add a lock entry and a uses: line for a private repository that token can read. The next relock would then publish its commit SHA in a bot PR. This needs no update to trigger. On the App server the token is read-only metadata scoped to one repository, so the risk is nil there.
  • The tool's fresh-tag warning is not shown.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
count-patchula 37ce497 Commit Preview URL

Branch Preview URL
Nov 14 2026, 03:10 AM

Lockfile maintenance now plans an Actions job when
.github/workflows/actions.lock exists and the github-actions manager is
on. It runs gh-actions-lock with --relock over the whole workflow
directory, with --no-onboard and --no-narrow as always, and never
--accept-moved or --migrate-local-actions. A whole-directory run also
prunes listed workflows that no longer exist; with --no-onboard the
tool skips unlisted workflows entirely when it writes, so nothing is
onboarded. The run uses the update run's environment and token, and the
same classification: a retryable finding waits, any other blocking
finding (an unreachable-pin in any workflow included) fails with the
tool's category and detail.

Proof: the regenerated lock must list exactly the listed workflows the
repository still holds (a relock may drop only deleted ones, and adds
none), then --verify-local over that set (a whole-directory verify would
fail on every unlisted workflow), and the commit may hold actions.lock
alone; a relock that rewrites a workflow fails. When every listed
workflow is gone the tool removes actions.lock, and the maintenance
commit deletes it; a removal while a listed workflow remains fails. A
failed relock holds only itself: the tree goes back to what the other
maintenance jobs left, and the failure is a report warning unless
nothing else changed, when it fails the branch.

The maintenance PR lists each moved ref under its workflow, read from
the lock diff: the tool prints a ref-moved finding for a moved direct
ref but not for one inside a composite.

With an Actions job, a workflow or action file that is not a regular
file (a symlink) stays out of the checkout instead of failing it: the
tool fails on what it cannot read, which holds only the Actions work. On
the update path a $/ callers walk that reaches one holds the update.

A lock without dependencies: (the tool omits an empty map) reads back.

Finding.retryable now defaults to false: the tool writes it omitempty,
so a non-retryable finding no longer reads as unparseable.

Behaviour change: in a repository with .github/workflows/actions.lock,
lockfile maintenance advances the refs that moved upstream in the
workflows the lockfile lists, drops listed workflows that were deleted,
lists the moved refs in the maintenance PR, and deletes actions.lock
when every workflow it lists is gone. It never adds a workflow or
action, never rewrites a workflow, and applies no release-age wait to
what it picks up.
@sweepies
sweepies force-pushed the feat/actions-lock-relock branch from e280952 to 37ce497 Compare November 14, 2026 03:10
@sweepies
sweepies merged commit e6c9d18 into main Nov 14, 2026
13 checks passed
@sweepies
sweepies deleted the feat/actions-lock-relock branch November 14, 2026 03:19
@sweepies-ops sweepies-ops Bot mentioned this pull request Nov 14, 2026
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