From 48b8102b2b147b75952f0f2691f8daa6f35a8106 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 20 Aug 2026 16:01:36 +0000 Subject: [PATCH 1/3] fix(ci): fetch upstream objects so plus branch sync works - Configure upstream as a promisor remote when checkout uses filter:blob:none - Prefetch upstream blobs with git fetch --no-filter before merge - Use git merge --abort || true so failed merges still set merge_success=false - Skip needs-reply workflow when GitHub issues are disabled Co-authored-by: Martin DONADIEU --- .github/workflows/needs-reply.yml | 15 +++++++++++++++ .github/workflows/sync-branches.yml | 26 ++++++++++++++++++++++---- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/.github/workflows/needs-reply.yml b/.github/workflows/needs-reply.yml index fe89093b4..488a6b8ab 100644 --- a/.github/workflows/needs-reply.yml +++ b/.github/workflows/needs-reply.yml @@ -10,11 +10,26 @@ jobs: # Keep this job capped at 10 minutes; never raise it unless explicitly asked. timeout-minutes: 10 steps: + - name: Check if issues are enabled + id: check-issues + env: + GH_TOKEN: ${{ github.token }} + run: | + HAS_ISSUES=$(gh api "repos/${GITHUB_REPOSITORY}" --jq '.has_issues') + echo "has_issues=${HAS_ISSUES}" >> "$GITHUB_OUTPUT" + + - name: Skip when issues are disabled + if: steps.check-issues.outputs.has_issues != 'true' + run: echo "Issues are disabled on ${GITHUB_REPOSITORY}; skipping needs-reply workflow." + - name: Setup Node.js + if: steps.check-issues.outputs.has_issues == 'true' uses: actions/setup-node@v6 with: node-version: 24.x + - name: Close old issues that need reply + if: steps.check-issues.outputs.has_issues == 'true' uses: imhoffd/needs-reply@v2.0.0 with: repo-token: ${{ secrets.BOT_TOKEN }} diff --git a/.github/workflows/sync-branches.yml b/.github/workflows/sync-branches.yml index 68b8d0cbd..e7994b433 100644 --- a/.github/workflows/sync-branches.yml +++ b/.github/workflows/sync-branches.yml @@ -50,7 +50,12 @@ jobs: - name: Add upstream and fetch run: | git remote add upstream https://github.com/${{ env.UPSTREAM_REPO }}.git || true + # checkout uses filter:blob:none, so origin is the promisor remote; upstream must be too + # or merge lazy-fetches ionic-team blobs from origin and fails with "not our ref" + git config remote.upstream.promisor true + git config remote.upstream.partialclonefilter blob:none git fetch upstream main + git fetch --no-filter upstream main - name: Check for new commits id: check-commits @@ -98,8 +103,12 @@ jobs: git push origin main echo "merge_success=true" >> $GITHUB_OUTPUT else - echo "Merge conflict detected" - git merge --abort + if [ -f .git/MERGE_HEAD ]; then + echo "Merge conflict detected" + else + echo "Merge failed before MERGE_HEAD was created (missing git objects or other error)" + fi + git merge --abort || true echo "merge_success=false" >> $GITHUB_OUTPUT fi @@ -181,7 +190,12 @@ jobs: - name: Add upstream and fetch run: | git remote add upstream https://github.com/${{ env.UPSTREAM_REPO }}.git || true + # checkout uses filter:blob:none, so origin is the promisor remote; upstream must be too + # or merge lazy-fetches ionic-team blobs from origin and fails with "not our ref" + git config remote.upstream.promisor true + git config remote.upstream.partialclonefilter blob:none git fetch upstream main + git fetch --no-filter upstream main - name: Check for new commits id: check-commits @@ -210,8 +224,12 @@ jobs: echo "Merge successful!" echo "merge_success=true" >> $GITHUB_OUTPUT else - echo "Merge conflict detected" - git merge --abort + if [ -f .git/MERGE_HEAD ]; then + echo "Merge conflict detected" + else + echo "Merge failed before MERGE_HEAD was created (missing git objects or other error)" + fi + git merge --abort || true echo "merge_success=false" >> $GITHUB_OUTPUT fi From 2bf95064c148731e8fbdf8f7045bb921c57469c8 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 20 Aug 2026 16:28:32 +0000 Subject: [PATCH 2/3] fix(ci): guard has_issues API check in needs-reply workflow Co-authored-by: Martin DONADIEU --- .github/workflows/needs-reply.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/needs-reply.yml b/.github/workflows/needs-reply.yml index 488a6b8ab..e75e7324d 100644 --- a/.github/workflows/needs-reply.yml +++ b/.github/workflows/needs-reply.yml @@ -15,7 +15,7 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | - HAS_ISSUES=$(gh api "repos/${GITHUB_REPOSITORY}" --jq '.has_issues') + HAS_ISSUES=$(gh api "repos/${GITHUB_REPOSITORY}" --jq '.has_issues' 2>/dev/null || echo "false") echo "has_issues=${HAS_ISSUES}" >> "$GITHUB_OUTPUT" - name: Skip when issues are disabled From 0899e73c9d16f34f703402f91b72aa518a2d88eb Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 20 Aug 2026 16:38:23 +0000 Subject: [PATCH 3/3] fix(ci): tighten sync merge failure handling per review - Use a single git fetch --no-filter upstream main - Gate conflict PRs on merge_conflict, not all merge failures - Reset to origin on failed merge --abort; exit 1 for pre-merge errors Co-authored-by: Martin DONADIEU --- .github/workflows/sync-branches.yml | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/sync-branches.yml b/.github/workflows/sync-branches.yml index e7994b433..f7ab9b84a 100644 --- a/.github/workflows/sync-branches.yml +++ b/.github/workflows/sync-branches.yml @@ -54,7 +54,6 @@ jobs: # or merge lazy-fetches ionic-team blobs from origin and fails with "not our ref" git config remote.upstream.promisor true git config remote.upstream.partialclonefilter blob:none - git fetch upstream main git fetch --no-filter upstream main - name: Check for new commits @@ -105,15 +104,18 @@ jobs: else if [ -f .git/MERGE_HEAD ]; then echo "Merge conflict detected" + echo "merge_conflict=true" >> $GITHUB_OUTPUT + git merge --abort || git reset --hard origin/main + echo "merge_success=false" >> $GITHUB_OUTPUT else echo "Merge failed before MERGE_HEAD was created (missing git objects or other error)" + git merge --abort || true + exit 1 fi - git merge --abort || true - echo "merge_success=false" >> $GITHUB_OUTPUT fi - name: Create PR for conflicts - if: steps.regular-merge.outputs.merge_success == 'false' + if: steps.regular-merge.outputs.merge_conflict == 'true' env: GH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} run: | @@ -194,7 +196,6 @@ jobs: # or merge lazy-fetches ionic-team blobs from origin and fails with "not our ref" git config remote.upstream.promisor true git config remote.upstream.partialclonefilter blob:none - git fetch upstream main git fetch --no-filter upstream main - name: Check for new commits @@ -226,11 +227,14 @@ jobs: else if [ -f .git/MERGE_HEAD ]; then echo "Merge conflict detected" + echo "merge_conflict=true" >> $GITHUB_OUTPUT + git merge --abort || git reset --hard origin/plus + echo "merge_success=false" >> $GITHUB_OUTPUT else echo "Merge failed before MERGE_HEAD was created (missing git objects or other error)" + git merge --abort || true + exit 1 fi - git merge --abort || true - echo "merge_success=false" >> $GITHUB_OUTPUT fi - name: Push if merge succeeded @@ -240,7 +244,7 @@ jobs: echo "Successfully pushed upstream changes to plus branch" - name: Create PR for conflicts - if: steps.merge.outputs.merge_success == 'false' + if: steps.merge.outputs.merge_conflict == 'true' env: GH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} run: |