Skip branch scans for symbolic action refs by nodeselector · Pull Request #93 · github/gh-actions-lock · GitHub
Skip to content

Skip branch scans for symbolic action refs - #93

Merged
nodeselector merged 3 commits into
mainfrom
nodeselector-audit-branch-scans
Jul 24, 2026
Merged

nodeselector merged 3 commits into
mainfrom
nodeselector-audit-branch-scans

Conversation

@nodeselector

@nodeselector nodeselector commented Jul 24, 2026 •

Copy link
Copy Markdown
Collaborator

What

Avoid pin-time branch discovery for symbolic action refs such as @v4 and @main.

Why

Reverse-looking up every resolved dependency caused unnecessary GitHub API requests and could burn through rate limits even when the original symbolic ref already contained all metadata needed for the lockfile.

How

ReverseLookup now leaves symbolic refs unchanged. Branch and tag discovery remains limited to bare SHA refs, where a symbolic lockfile ref must actually be recovered.

Tests enforce that symbolic refs issue no reverse-lookup requests while bare SHAs retain the existing named, likely, and full-scan fallback behavior.

Risk

Low and reversible. The change removes redundant metadata enrichment for symbolic refs; resolution and SHA verification are unchanged.

Testing

  • go test ./...

Copilot AI review requested due to automatic review settings July 24, 2026 18:06
@nodeselector
nodeselector requested a review from a team as a code owner July 24, 2026 18:06

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.

Pull request overview

Skips reverse-lookup API scans for symbolic action refs while retaining discovery for bare SHAs.

Changes:

  • Short-circuits reverse lookup for symbolic refs.
  • Removes obsolete HTTP mocks.
  • Updates SHA fallback and no-network tests.
Show a summary per file
File Description
internal/resolve/reverse_lookup.go Adds symbolic-ref short-circuiting.
internal/resolve/discover_test.go Updates reverse-lookup behavior tests.
internal/pin/plan_test.go Adjusts planning fixtures and SHA tests.
cmd/gh-actions-lock/migrate_test.go Removes redundant reverse-lookup mocks.
cmd/gh-actions-lock/command_test.go Simplifies command test metadata mocks.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comments suppressed due to low confidence (1)

internal/resolve/discover_test.go:426

  • A symbolic @main ref can be classified locally as a branch, so expecting Branch to remain empty contradicts the stated behavior and removes on_branch from the resulting pin entry. Assert main here while retaining the empty registry to prove classification does not perform an API call.
	if deps[0].Branch != "" {
		t.Errorf("expected Branch empty, got %q", deps[0].Branch)
  • Files reviewed: 5/5 changed files
  • Comments generated: 2
  • Review effort level: Medium

Comment thread internal/resolve/reverse_lookup.go
Comment thread internal/resolve/discover_test.go
@nodeselector
nodeselector merged commit f1950c5 into main Jul 24, 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