Fix/PR checkout branch name conflicts #931
Open
+15
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Fixes #930
PR checkout fails when the PR's branch name conflicts with existing local or remote branches. This issue was introduced in #851 when adding fork PR support.
Solution
Use unique local branch names in
pr-{number}format (e.g.,pr-123) instead of the original branch name when checking out PRs.Example:
Changes
src/github/operations/branch.ts:pr-{number}as local branch name for checkoutBenefits
pull/{number}/headrefsTesting
Existing tests cover the
pr-{number}format (validated as hyphenated branch names).Verification
✅ Tested successfully on private repository:
test/claude-action-fork-fixpr-{number}format