--no-narrow skips bare-SHA to tag rewriting by nodeselector · Pull Request #69 · github/gh-actions-lock · GitHub
Skip to content

--no-narrow skips bare-SHA to tag rewriting - #69

Merged
nodeselector merged 1 commit into
mainfrom
nodeselector-no-narrow-keeps-commit-sha
Jun 26, 2026
Merged

nodeselector merged 1 commit into
mainfrom
nodeselector-no-narrow-keeps-commit-sha

Conversation

@nodeselector

Copy link
Copy Markdown
Collaborator

Why

Users migrating from zizmor or GitHub's commit-SHA enforcement can't easily adopt the lockfile today. --no-narrow suppresses imprecise version narrowing (v4 -> v4.2.1), but bare commit SHAs are still unconditionally rewritten to their best matching tag. This forces users to disable their existing SHA-enforcement tooling across every repo before they can onboard -- a painful migration tax.

Reported in github-early-access/actions-locked-dependencies#35.

Approach

The bare-SHA block in narrowDirectDeps now checks opts.NoNarrow before attempting the SHA-to-tag lookup, mirroring the guard that already exists for imprecise version refs. When --no-narrow is set, commit-pinned references pass through unchanged.

narrowVerifiedEntries already respected NoNarrow (early-returns nil), so no change needed there.

Testing

  • Unit test (TestNoNarrow_KeepsBareSHA): verifies that a bare-SHA dep is preserved when NoNarrow is true, even when a tagger would find a matching tag.
  • Integration scenario (fresh_no_narrow_keeps_bare_sha): end-to-end with actions/checkout@<sha> confirming the lockfile key retains the full SHA.

Closes github-early-access/actions-locked-dependencies#35

Copilot AI review requested due to automatic review settings June 26, 2026 19: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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

GitHub Advanced Security started work on behalf of nodeselector June 26, 2026 19:50
GitHub Advanced Security finished work on behalf of nodeselector June 26, 2026 19:50
@nodeselector
nodeselector force-pushed the nodeselector-no-narrow-keeps-commit-sha branch from dd1b188 to e742c63 Compare June 26, 2026 19:54
GitHub Advanced Security started work on behalf of nodeselector June 26, 2026 19:55
GitHub Advanced Security finished work on behalf of nodeselector June 26, 2026 19:55
@nodeselector
nodeselector requested a review from Copilot June 26, 2026 19:56

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.

✅ Ready to approve

The behavior change is small and well-covered by new unit + integration tests, with only a minor test-strengthening nit noted.

Note: this review does not count toward required approvals for merging.

Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 1
  • Review effort level: Low

Note

Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.

Comment thread internal/pin/plan_test.go Outdated
Previously --no-narrow only suppressed imprecise version refs (v4 → v4.2.1)
but unconditionally rewrote bare commit SHAs to their best matching tag.
Users migrating from zizmor/SHA-enforcement workflows couldn't adopt the
lockfile without disabling those tools first.

Now --no-narrow also skips the bare-SHA → tag lookup, letting commit-pinned
references pass through unchanged.

Closes github-early-access/actions-locked-dependencies#35
@nodeselector
nodeselector force-pushed the nodeselector-no-narrow-keeps-commit-sha branch from e742c63 to d834264 Compare June 26, 2026 20:14
GitHub Advanced Security started work on behalf of nodeselector June 26, 2026 20:15
GitHub Advanced Security finished work on behalf of nodeselector June 26, 2026 20:15
@nodeselector
nodeselector merged commit 61257e4 into main Jun 26, 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