You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Detect and fix CI failures early with batched push
Track failed jobs during workflow execution and fix each immediately
with local commits. Push all fix commits together when workflow
completes to minimize CI runs while maintaining clean git history.
log.failed(`Detected ${newFailures.length} new failed job(s)`)
3434
+
3435
+
// Fix each failed job immediately
3436
+
for(constjobofnewFailures){
3437
+
log.substep(`❌ ${job.name}: ${job.conclusion}`)
3438
+
3439
+
// Fetch logs for this specific failed job
3440
+
log.progress(`Fetching logs for ${job.name}`)
3441
+
constlogsResult=awaitrunCommandWithOutput(
3442
+
'gh',
3443
+
[
3444
+
'run',
3445
+
'view',
3446
+
lastRunId.toString(),
3447
+
'--repo',
3448
+
`${owner}/${repo}`,
3449
+
'--log-failed',
3450
+
],
3451
+
{
3452
+
cwd: rootPath,
3453
+
},
3454
+
)
3455
+
console.log('')
3456
+
3457
+
// Analyze and fix with Claude
3458
+
log.progress(`Analyzing failure in ${job.name}`)
3459
+
constfixPrompt=`You are automatically fixing CI failures. The job "${job.name}" failed in workflow run ${lastRunId} for commit ${currentSha} in ${owner}/${repo}.
3460
+
3461
+
Job: ${job.name}
3462
+
Status: ${job.conclusion}
3463
+
3464
+
Failure logs:
3465
+
${logsResult.stdout||'No logs available'}
3466
+
3467
+
Your task:
3468
+
1. Analyze these CI logs for the "${job.name}" job
3469
+
2. Identify the root cause of the failure
3470
+
3. Apply fixes directly to resolve the issue
3471
+
3472
+
Focus on:
3473
+
- Test failures: Update snapshots, fix test logic, or correct test data
3474
+
- Lint errors: Fix code style and formatting issues
3475
+
- Type checking: Fix type errors and missing type annotations
0 commit comments