Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/github/operations/branch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ export async function setupBranch(

// Execute git commands to checkout PR branch (dynamic depth based on PR size)
// Using execFileSync instead of shell template literals for security
execGit(["fetch", "origin", `--depth=${fetchDepth}`, branchName]);
// Use GitHub's PR ref which works for both same-repo and fork PRs
execGit(["fetch", "origin", `--depth=${fetchDepth}`, `pull/${entityNumber}/head:${branchName}`]);
execGit(["checkout", branchName, "--"]);

console.log(`Successfully checked out PR branch for PR #${entityNumber}`);
Expand Down
Loading