fix(ci): fetch upstream objects so plus branch sync works

Merged
RI
3mo ago
+47-10

What

  • Fix sync-branches.yml so merges with ionic-team/capacitor work under actions/checkout partial clones (filter: blob:none).
  • Harden merge failure handling so the workflow can open conflict PRs instead of exiting 128.
  • Make needs-reply.yml a no-op success when GitHub issues are disabled on this repo.

Why

The scheduled sync-plus-branch job has failed daily since partial-clone checkout was introduced. Latest failure: actions run 32334591459.

Root cause (verified in logs):

  1. actions/checkout@v6 with filter: blob:none makes origin (Cap-go/capacitor-plus) the promisor remote.
  2. The job fetches upstream/main but does not register upstream as a promisor remote.
  3. git merge upstream/main lazy-fetches missing blobs from origin, which does not have Ionic objects → upload-pack: not our ref / could not fetch … from promisor remote.
  4. Merge never starts (MERGE_HEAD missing), but the step prints "Merge conflict detected" for any non-zero merge exit.
  5. git merge --abort then fails with exit 128 under bash -e, so merge_success=false is never written and the "Create PR for conflicts" step is skipped.

sync-main-branch currently succeeds only because there are no pending upstream commits; it uses the same pattern and would hit the same bug once upstream moves ahead.

How

sync-branches.yml (both sync-main-branch and sync-plus-branch)

  • After adding upstream, configure it as a promisor remote with the same blob filter as checkout.
  • Run git fetch --no-filter upstream main to prefetch merge objects from Ionic before merging.
  • On merge failure: distinguish conflict vs pre-merge failure in logs, use git merge --abort || true, and always write merge_success=false so conflict PR creation can run.

needs-reply.yml

  • Query repos/{owner}/{repo}.has_issues via gh api.
  • Skip the imhoffd/needs-reply action when issues are disabled (currently false on Cap-go/capacitor-plus). The scheduled job exits green instead of failing on missing/disabled issue APIs.

Testing

  • Reproduced the CI failure signature from run 32334591459 logs.
  • Locally simulated partial clones (filter:blob:none + origin promisor) and confirmed merge reaches normal conflict resolution with upstream promisor config + --no-filter fetch (no promisor fatal).
  • Confirmed plus is 30 commits behind ionic-team/capacitor main (merge-base b3c769e8).

Not Tested

  • Full GitHub Actions run after merge (please re-run Sync Branches from Upstream → plus via workflow_dispatch once this PR is merged).

plus catch-up (follow-up — not in this PR)

A local merge of upstream/main into plus is not clean: conflicts in Capgo overlays and upstream churn, including:

  • .github/workflows/ci.yml (deleted on plus, modified upstream)
  • CHANGELOG.md files and lerna.json / package versions
  • android/.../SystemBars.java, SystemBarsTest.java, BridgeWebChromeClient.java
  • android|cli|core|ios/package.json

This PR fixes the automation only. After merge, the workflow should either push a clean merge or open a conflict-resolution PR.

Existing open sync PRs left untouched:

  • #81 — upstream PR #8521 (sync/upstream-pr-8521)
  • #82 — upstream PR #8524 (sync/upstream-pr-8524)

How to verify after merge

  1. Actions → Sync Branches from Upstream → Run workflow → branch: plus.
  2. Expect sync-plus-branch to pass or open/update a conflict sync PR (not exit 128 on promisor errors).
  3. Confirm needs-reply.yml scheduled run succeeds with "Issues are disabled … skipping".
Open in Web Open in Cursor 

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Summary by CodeRabbit

  • Bug Fixes
    • Improved workflow behavior when issue tracking is disabled by skipping unnecessary issue-processing steps.
    • Enhanced branch synchronization reliability, including safer handling of fetches, merge conflicts, and merge cleanup.