Skip to content

fix(github): avoid fork PR branch checkout collisions#1431

Open
riverpilot wants to merge 1 commit into
anthropics:mainfrom
riverpilot:fix/fork-pr-branch-collision
Open

fix(github): avoid fork PR branch checkout collisions#1431
riverpilot wants to merge 1 commit into
anthropics:mainfrom
riverpilot:fix/fork-pr-branch-collision

Conversation

@riverpilot

Copy link
Copy Markdown

Summary

Fixes #1423

Screenshots

No visual change.

Testing

  • bun test test/setup-branch.test.ts
  • bun run typecheck
  • bun run format:check

Risk

  • Low: same-repository PR checkout is unchanged; cross-repository PR checkout now uses the existing GitHub pull ref without updating local branches.

Notes

AI Review Report

  • Verified the current setupBranch fork path still fetched pull/N/head:<headRefName> before this patch.
  • Added a regression test that starts on local main, exposes a fork PR ref also named main, and verifies HEAD detaches at the PR ref while refs/heads/main stays unchanged.

Security Audit

  • Git commands still use execFileSync argv arrays, not shell interpolation.
  • The new destination ref is derived from the numeric PR entity number, not from user-controlled branch text.

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.

Fork PR whose head branch matches the runner's checked-out branch fails: "refusing to fetch into branch 'refs/heads/main'"

1 participant