From f7019533d22ffd667323ba8333d50823613b3fad Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 3 Nov 2026 17:25:40 +0000 Subject: [PATCH] ci: leave the cascade PR open when auto-merge is not allowed With "Allow auto-merge" off in the repository settings, enabling auto-merge on the cascade PR fails with "Auto merge is not allowed for this repository", which failed the whole job although the PR was opened (#257). The job now reports a notice and leaves the PR open for a manual merge; any other failure of `gh pr merge` still fails it. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01FxhC1CBg4rnTu9UjAMcCpL --- .github/workflows/cascade-merge.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cascade-merge.yml b/.github/workflows/cascade-merge.yml index 137c3ce..a9d2f95 100644 --- a/.github/workflows/cascade-merge.yml +++ b/.github/workflows/cascade-merge.yml @@ -43,7 +43,7 @@ jobs: --title "Cascade merge: 4.x into master" \ --body "Automated cascade merge that keeps \`master\` in sync with the \`4.x\` maintenance branch. - This PR tracks \`4.x\` and merges automatically once required checks pass. A new one is opened after each merge, so every future push to \`4.x\` keeps flowing forward into \`master\`. + This PR tracks \`4.x\` and merges automatically once required checks pass, when auto-merge is allowed for the repository; otherwise merge it manually. A new one is opened after each merge, so every future push to \`4.x\` keeps flowing forward into \`master\`. If this PR shows a conflict, resolve it manually on \`4.x\` (or directly on this PR's branch) — auto-merge will pick it up once it's clean again." \ > /tmp/pr-create.log 2>&1; then @@ -58,4 +58,12 @@ jobs: fi echo "Enabling auto-merge on PR #$PR_NUMBER" - gh pr merge "$PR_NUMBER" --merge --auto + if ! gh pr merge "$PR_NUMBER" --merge --auto > /tmp/pr-merge.log 2>&1; then + cat /tmp/pr-merge.log + # "Allow auto-merge" is off in the repository settings: the PR stays open for a manual merge + if grep -qi "Auto merge is not allowed" /tmp/pr-merge.log; then + echo "::notice title=Cascade PR #$PR_NUMBER::Auto-merge is not allowed for this repository, merge the cascade PR manually." + exit 0 + fi + exit 1 + fi