Skip to content

Commit c2d5692

Browse files
committed
fix(ci): stop release-please auto-merge loop
Enable native auto-merge and stop, instead of waiting 60s then deleting the release branch and self-dispatching, which destroyed the release PR before its required checks finished and looped forever.
1 parent b6aed64 commit c2d5692

1 file changed

Lines changed: 4 additions & 19 deletions

File tree

.github/workflows/release-please.yml

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,30 +25,15 @@ jobs:
2525
config-file: release-please-config.json
2626
manifest-file: .release-please-manifest.json
2727

28+
# Enable native auto-merge and stop; GitHub rebase-merges once the required
29+
# checks pass, and that PAT-authored merge re-triggers this workflow to cut
30+
# the tag/release.
2831
- if: ${{ steps.release.outputs.pr }}
2932
env:
3033
GH_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN }}
3134
REPO: ${{ github.repository }}
32-
WORKFLOW: ${{ github.workflow }}
3335
PR_JSON: ${{ steps.release.outputs.pr }}
34-
run: |
35-
PR=$(echo "$PR_JSON" | jq -r .number)
36-
BRANCH=$(echo "$PR_JSON" | jq -r .headBranchName)
37-
# Rebase-merge works when main has advanced past the release branch's
38-
# base. When the release commit already sits directly on main HEAD,
39-
# GitHub refuses ("This branch can't be rebased") on a rebase-only
40-
# repo — fast-forward main to the release commit via the API instead.
41-
gh pr merge --rebase --auto -R "$REPO" "$PR" \
42-
|| gh pr merge --rebase -R "$REPO" "$PR" \
43-
|| gh api -X PATCH "repos/$REPO/git/refs/heads/main" \
44-
-f sha="$(gh api "repos/$REPO/git/refs/heads/$BRANCH" --jq .object.sha)"
45-
for _ in $(seq 1 30); do
46-
STATE=$(gh pr view "$PR" -R "$REPO" --json state --jq .state)
47-
[ "$STATE" = "MERGED" ] && break
48-
sleep 2
49-
done
50-
gh api -X DELETE "repos/$REPO/git/refs/heads/$BRANCH" 2>/dev/null || true
51-
gh workflow run "$WORKFLOW" -R "$REPO" --ref main
36+
run: gh pr merge --rebase --auto -R "$REPO" "$(echo "$PR_JSON" | jq -r .number)"
5237

5338
# When a release is actually published, redeploy from main so the live
5439
# build carries the bumped version. release-please's own version-bump

0 commit comments

Comments
 (0)