pull/13820/merge
青雲 2026-04-08 06:38:11 +00:00 committed by GitHub
commit 18beca1968
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 2 deletions

View File

@ -94,7 +94,7 @@ type GitHubPullRequest = {
}
headRepository: {
nameWithOwner: string
}
} | null
commits: {
totalCount: number
nodes: Array<{
@ -607,7 +607,7 @@ export const GithubRunCommand = cmd({
) {
const prData = await fetchPR()
// Local PR
if (prData.headRepository.nameWithOwner === prData.baseRepository.nameWithOwner) {
if (prData.headRepository?.nameWithOwner === prData.baseRepository.nameWithOwner) {
await checkoutLocalBranch(prData)
const head = await gitText(["rev-parse", "HEAD"])
const dataPrompt = buildPromptDataForPR(prData)
@ -1109,6 +1109,10 @@ export const GithubRunCommand = cmd({
async function checkoutForkBranch(pr: GitHubPullRequest) {
console.log("Checking out fork branch...")
if (!pr.headRepository) {
throw new Error("Cannot checkout fork branch: the source repository has been deleted or is inaccessible")
}
const remoteBranch = pr.headRefName
const localBranch = generateBranchName("pr")
const depth = Math.max(pr.commits.totalCount, 20)