MCPcopy Index your code
hub / github.com/anomalyco/opencode / checkoutForkBranch

Function checkoutForkBranch

packages/opencode/src/cli/cmd/github.handler.ts:1057–1068  ·  view source on GitHub ↗
(pr: GitHubPullRequest)

Source from the content-addressed store, hash-verified

1055 }
1056
1057 async function checkoutForkBranch(pr: GitHubPullRequest) {
1058 console.log("Checking out fork branch...")
1059
1060 const remoteBranch = pr.headRefName
1061 const localBranch = generateBranchName("pr")
1062 const depth = Math.max(pr.commits.totalCount, 20)
1063
1064 await gitRun(["remote", "add", "fork", `https://github.com/${pr.headRepository.nameWithOwner}.git`])
1065 await gitRun(["fetch", "fork", `--depth=${depth}`, remoteBranch])
1066 await gitRun(["checkout", "-b", localBranch, `fork/${remoteBranch}`])
1067 return localBranch
1068 }
1069
1070 function generateBranchName(type: "issue" | "pr" | "schedule" | "dispatch") {
1071 const timestamp = new Date()

Callers 1

github.handler.tsFile · 0.70

Calls 3

gitRunFunction · 0.85
generateBranchNameFunction · 0.70
logMethod · 0.45

Tested by

no test coverage detected