fix: prepare branch before PR field generation (#2401)

This commit is contained in:
Jinjing
2026-05-19 22:20:56 -07:00
committed by GitHub
parent 9adb33c24a
commit dbc24be41d
13 changed files with 459 additions and 40 deletions
+20 -12
View File
@@ -443,22 +443,30 @@ export class RuntimeGitCommands {
error: SSH_GIT_PROVIDER_UNAVAILABLE_MESSAGE
}
}
const context = target.connectionId
? await getPullRequestDraftContext((argv) => provider!.exec(argv, target.worktree.path), {
base: input.base,
currentTitle: input.title,
currentBody: input.body,
currentDraft: input.draft
})
: await getPullRequestDraftContext(
(argv, options) => gitExecFileAsync(argv, { cwd: target.worktree.path, ...options }),
{
let context: Awaited<ReturnType<typeof getPullRequestDraftContext>>
try {
context = target.connectionId
? await getPullRequestDraftContext((argv) => provider!.exec(argv, target.worktree.path), {
base: input.base,
currentTitle: input.title,
currentBody: input.body,
currentDraft: input.draft
}
)
})
: await getPullRequestDraftContext(
(argv, options) => gitExecFileAsync(argv, { cwd: target.worktree.path, ...options }),
{
base: input.base,
currentTitle: input.title,
currentBody: input.body,
currentDraft: input.draft
}
)
} catch (error) {
return {
success: false,
error: error instanceof Error ? error.message : 'Failed to prepare branch for PR details.'
}
}
if (!context) {
return { success: false, error: 'No branch changes to summarize.' }
}