@@ -319,6 +319,10 @@ export function releaseEvidenceVerificationArgs(parentRunId) {
319319 return [ "--validate-run" , String ( parentRunId ) , "--trusted-workflow-ref" , "main" , "--json" ] ;
320320}
321321
322+ export function shouldDeleteTemporaryWorkflowRef ( params ) {
323+ return ! params . keepBranch && ( params . dryRun || params . parentConclusion === "success" ) ;
324+ }
325+
322326export function releaseEvidenceVerifierPath ( worktreeRoot ) {
323327 const candidates = [
324328 join ( worktreeRoot , "scripts" , "release-ci-summary.mjs" ) ,
@@ -388,6 +392,7 @@ function main() {
388392 } ) ;
389393
390394 let parentRunId ;
395+ let parentConclusion = "" ;
391396 try {
392397 const dispatchArgs = [ "workflow" , "run" , WORKFLOW , "--ref" , branch ] ;
393398 for ( const [ key , value ] of Object . entries ( dispatchInputs ) ) {
@@ -416,16 +421,32 @@ function main() {
416421 }
417422
418423 console . log ( `Parent run: https://github.com/openclaw/openclaw/actions/runs/${ parentRunId } ` ) ;
419- waitForWorkflowRun ( parentRunId , workflowSha ) ;
424+ const completedRun = waitForWorkflowRun ( parentRunId , workflowSha ) ;
425+ parentConclusion = String ( completedRun . conclusion ?? "" ) ;
426+ if ( parentConclusion !== "success" ) {
427+ throw new Error (
428+ `Full Release Validation concluded ${ parentConclusion . toLowerCase ( ) || "without a conclusion" } : https://github.com/openclaw/openclaw/actions/runs/${ parentRunId } ` ,
429+ ) ;
430+ }
420431 verifyReleaseEvidence ( parentRunId , workflowSha ) ;
421432 } finally {
422- if ( ! args . keepBranch ) {
433+ if (
434+ shouldDeleteTemporaryWorkflowRef ( {
435+ keepBranch : args . keepBranch ,
436+ dryRun : args . dryRun ,
437+ parentConclusion,
438+ } )
439+ ) {
423440 run ( "git" , [ "push" , "origin" , `:${ remoteBranchRef } ` ] , {
424441 dryRun : args . dryRun ,
425442 stdio : "inherit" ,
426443 } ) ;
427444 } else {
428- console . log ( `Kept ${ remoteBranchRef } ` ) ;
445+ console . warn (
446+ args . keepBranch
447+ ? `Kept ${ remoteBranchRef } `
448+ : `Kept ${ remoteBranchRef } : parent concluded ${ parentConclusion || "without a conclusion" } . Keep it through any GitHub reruns; delete it after a successful parent attempt.` ,
449+ ) ;
429450 }
430451 }
431452}
0 commit comments