mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 14:30:41 +00:00
feat(test-recorder): add recovery hints on push/PR creation failure
Fixes #10729
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { execSync, spawnSync } from 'node:child_process'
|
||||
import { pass, fail } from '../ui/logger'
|
||||
import { pass, fail, info, blank } from '../ui/logger'
|
||||
|
||||
interface PrOptions {
|
||||
testFilePath: string
|
||||
@@ -35,6 +35,16 @@ export async function checkGhAvailable(): Promise<{
|
||||
}
|
||||
}
|
||||
|
||||
function logRecoveryHint(branchName: string) {
|
||||
blank()
|
||||
info([
|
||||
'To clean up and retry, run:',
|
||||
` git checkout -`,
|
||||
` git branch -D ${branchName}`
|
||||
])
|
||||
blank()
|
||||
}
|
||||
|
||||
export async function createPr(options: PrOptions): Promise<PrResult> {
|
||||
const branchName = options.branchName ?? `test/${options.testName}`
|
||||
const commitMsg = `test: add ${options.testName} e2e test\n\n${options.description}`
|
||||
@@ -80,6 +90,7 @@ export async function createPr(options: PrOptions): Promise<PrResult> {
|
||||
})
|
||||
if (push.status !== 0) {
|
||||
fail('Git push failed', push.stderr.trim())
|
||||
logRecoveryHint(branchName)
|
||||
return { success: false, error: push.stderr.trim() }
|
||||
}
|
||||
pass('Pushed branch', branchName)
|
||||
@@ -91,6 +102,7 @@ export async function createPr(options: PrOptions): Promise<PrResult> {
|
||||
)
|
||||
if (pr.status !== 0) {
|
||||
fail('PR creation failed', pr.stderr.trim())
|
||||
logRecoveryHint(branchName)
|
||||
return { success: false, error: pr.stderr.trim() }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user