fix(ci): harden upstream sync conflict handling

Merged
RI
7mo ago
+582-117

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.yml and sync-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-branch job at https://github.com/Cap-go/capacitor-plus/actions/runs/24119688928/job/70370891282 did not actually fail on merge conflicts; it failed because gh pr create --label ... errored when upstream-sync did 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.sh to create the sync labels on demand, add labels after PR creation, and detect whether issues are enabled
  • added .github/scripts/resolve-conflicts-with-claude.sh to let Claude Code resolve staged merge conflicts inside the sync branch worktree
  • updated sync-branches.yml to:
    • install Claude Code with Bun only on conflict paths
    • try Claude first on main and plus branch 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.yml with the same label hardening and Claude-first conflict handling for open PR syncs, main sync, and specific PR syncs
  • updated auto-merge-sync.yml to 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 --check
  • bash -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-lockfile currently fails in this checkout because Bun 1.3.11 reports the committed bun.lock would need updates, so root bun run lint could not be completed without rewriting the lockfile
  • GitHub Actions end-to-end behavior is not fully verified until this PR's CI runs