fix(ci): fork-sync 'Sync forks' step works under bash -e + existing-PR jq repair - #1721
Conversation
…isting-PR jq
Two bugs that only surface when dry_run=false (the sync step runs):
1) errexit: GitHub runs run: steps under 'bash -e'. The loop is best-effort
and uses 'cmd > /dev/null 2>&1; if [ $? -ne 0 ]' and '|| { ...; continue; }'
guards, which errexit defeats — a failing standalone gh api command aborts
the whole step before its check. The live run died on the first fork
(PMOVES-ClawZ) at branch creation. Fix: 'set +e' at the top of the loop.
2) malformed jq in the existing-sync-PR check ('[.[] | ... | .number' missing
the closing ']') errored silently, so existing sync PRs were never detected
-> duplicate-branch/PR risk on re-runs. Fix: close the array + '| .[0] // empty'.
Separate from #1718 (YAML block-scalar parse fix); that made workflow_dispatch/
dry-run work, this makes the actual sync run. YAML verified; jq filter validated.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Looking for one thing? Review this PR in Change Stack to search files, summaries, diffs, and code without losing your place. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR improves the fork sync GitHub Actions workflow by making it more resilient to iteration failures and fixing pull request detection logic. It disables bash error exit behavior in the fork-sync loop via ChangesFork Sync Workflow Fixes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Problem
The live fork-sync run (
dry_run=false, #27033914982) failed on the first fork (SYNC PMOVES-ClawZthen exit 1) — no sync PRs created on any fork.Two bugs, both only reachable when the sync step actually runs (dry-run exercises only the audit step, so #1718 didn't surface them):
run:steps under/usr/bin/bash -e. The loop is best-effort and relies oncmd > /dev/null 2>&1; if [ $? -ne 0 ]and|| { ...; continue; }guards. Under errexit, a failing standalonegh api(e.g. branch-creation) aborts the whole step before its$?check — which is exactly where it died.[.[] | select(...) | .numberis missing the closing], so it errored silently and never detected existing sync PRs → duplicate-branch/PR risk on re-runs.Fix
set +eat the top of the Sync-forks loop (matches the script's own error-handling design).| .[0] // empty.Verification
sync, 5 steps intact).Disposition
Unblocks the fork-sync remediation (CVE work). After merge, re-run
dry_run=false. Note: heavily-drifted forks whose upstream merge conflicts will still be skipped (branch auto-deleted) — expected; those need local conflict resolution.🤖 Generated with Claude Code
Summary by CodeRabbit