Skip to content

Lock refs another workflow rewrites in a shared $/ action - #231

Merged
nodeselector merged 2 commits into
mainfrom
nodeselector-shared-self-action-rewrites
Oct 22, 2026
Merged

nodeselector merged 2 commits into
mainfrom
nodeselector-shared-self-action-rewrites

Conversation

@nodeselector

Copy link
Copy Markdown
Collaborator

Workflows that reach the same in-repo $/ action share its rewrites. When one workflow keeps a full-SHA ref (a composite it uses declares that SHA) and another narrows the same ref to a tag, the shared action file is rewritten, but the first workflow's lockfile list still names only the SHA. The fix run exits 0 and --verify-local then reports ref-changed.

Commit now records, under each workflow, the pins that other workflows' rewrites give its shared action files. The runner looks up each uses: in a $/ action as written, so the workflow has to lock both refs. Rewriting both to one ref would instead rename the edge the composite declares. Full-SHA refs match case-insensitively.

@nodeselector
nodeselector requested a review from a team as a code owner October 22, 2026 01:49
Copilot AI max review requested due to automatic review settings October 22, 2026 01:49

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Shared-action rewrites can still leave an unused SHA recorded as a direct root, causing --verify-local to fail.

1 open issue
What changed in this PR

Updates lockfile generation so workflows sharing an in-repository $/ action record refs introduced by another workflow’s rewrites, while preserving refs declared by remote composites.

Changes:

  • Merges shared-action rewrites before updating workflow lockfile entries.
  • Adds regression coverage for shared rewrites, mixed-case full SHAs, and both verification modes.
File Description
internal/​pin/​commit.go Adopts pins introduced by shared-action rewrites before writing lockfile entries.
cmd/​gh-actions-lock/​run_test.go Tests shared-action rewriting and subsequent local and remote verification.

Review effort: Max

Comment thread internal/pin/commit.go Resolved
nodeselector and others added 2 commits October 21, 2026 21:26
Workflows that reach the same in-repo $/ action share its rewrites. When
one workflow kept a full-SHA ref (because a composite it uses declares
that SHA) and another narrowed it to a tag, the shared action file was
rewritten but the first workflow's lockfile list still named only the
SHA, so --verify-local reported ref-changed right after a successful
fix. Commit now records, under each workflow, the pins that other
workflows' rewrites give its shared action files.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
When another workflow's rewrite of a shared $/ action removed a
workflow's only direct use of a ref, the ref stayed a workflow root and
--verify-local reported it stale. Commit now drops it from the
workflow's roots unless the workflow, after its own rewrites, or one of
its $/ actions, after the merged rewrites, still uses it. The pin and
the composite edge that requires it stay.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@nodeselector
nodeselector force-pushed the nodeselector-shared-self-action-rewrites branch from e54e09e to e49d35d Compare October 22, 2026 04:27
@nodeselector
nodeselector merged commit 4cf118d into main Oct 22, 2026
11 checks passed
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.

2 participants