MCPcopy Create free account
hub / github.com/anomalyco/opencode / checkoutForkBranch

Function checkoutForkBranch

github/index.ts:701–711  ·  view source on GitHub ↗
(pr: GitHubPullRequest)

Source from the content-addressed store, hash-verified

699}
700
701async function checkoutForkBranch(pr: GitHubPullRequest) {
702 console.log("Checking out fork branch...")
703
704 const remoteBranch = pr.headRefName
705 const localBranch = generateBranchName("pr")
706 const depth = Math.max(pr.commits.totalCount, 20)
707
708 await $`git remote add fork https://github.com/${pr.headRepository.nameWithOwner}.git`
709 await $`git fetch fork --depth=${depth} ${remoteBranch}`
710 await $`git checkout -b ${localBranch} fork/${remoteBranch}`
711}
712
713function generateBranchName(type: "issue" | "pr") {
714 const timestamp = new Date()

Callers 1

index.tsFile · 0.70

Calls 2

generateBranchNameFunction · 0.70
logMethod · 0.45

Tested by

no test coverage detected