fix(ci): harden upstream sync conflict handling
Merged
RI
7mo ago+582+582+012345678901234567890123456789-117-117-012345678901234567890123456789
What
- harden the sync workflows so missing custom labels no longer break PR creation or review follow-up
- add shared GitHub helper scripts for label creation, PR labeling, and issues-enabled checks
- add Claude Code based conflict resolution attempts for
sync-branches.ymlandsync-upstream.yml, with safe PR/comment fallbacks when AI cannot finish cleanly - switch the touched workflow paths from
npm/global install usage to Bun-based setup for repo consistency
Why
- the failing
sync-plus-branchjob at https://github.com/Cap-go/capacitor-plus/actions/runs/24119688928/job/70370891282 did not actually fail on merge conflicts; it failed becausegh pr create --label ...errored whenupstream-syncdid not exist - the repo also has issues disabled, so other upstream-sync fallback paths were one bad merge away from failing for the same reason
- conflict PRs should try AI-assisted resolution first instead of immediately dropping into brittle manual fallbacks
How
- added
.github/scripts/sync-gh-helpers.shto create the sync labels on demand, add labels after PR creation, and detect whether issues are enabled - added
.github/scripts/resolve-conflicts-with-claude.shto let Claude Code resolve staged merge conflicts inside the sync branch worktree - updated
sync-branches.ymlto:- install Claude Code with Bun only on conflict paths
- try Claude first on
mainandplusbranch conflicts - create the PR first, then add labels separately so label problems cannot abort the job
- comment on fallback/manual-review PRs instead of failing the workflow
- updated
sync-upstream.ymlwith the same label hardening and Claude-first conflict handling for open PR syncs, main sync, and specific PR syncs - updated
auto-merge-sync.ymlto ensure labels exist before review runs, install Claude Code via Bun, and comment on the PR when issues are disabled instead of failing the notify step
Testing
git diff --checkbash -n .github/scripts/sync-gh-helpers.sh .github/scripts/resolve-conflicts-with-claude.sh- YAML parse smoke check via
ruby -e 'require "yaml"; ARGV.each { |f| YAML.load_file(f) }' .github/workflows/*.yml
Not Tested
bun install --frozen-lockfilecurrently fails in this checkout because Bun 1.3.11 reports the committedbun.lockwould need updates, so rootbun run lintcould not be completed without rewriting the lockfile- GitHub Actions end-to-end behavior is not fully verified until this PR's CI runs