Skip to content

Commit 37eeda9

Browse files
committed
ci(release): stop release-please auto-merge loop
The release job deleted the release branch and re-dispatched itself when the PR had not merged within 60s. Because the PR was authored by GITHUB_TOKEN its CI never ran (action_required), so it never went green, auto-merge never fired, and the branch-delete + self-redispatch recreated the release PR every ~90s indefinitely. Mirror the working sister-app config: author the PR with RELEASE_PLEASE_TOKEN so CI runs on it, then just enable native auto-merge. The PAT-authored merge is a push to main that re-triggers this workflow to cut the release and the on:push deploy, so the delete/redispatch and explicit deploy dispatch are no longer needed.
1 parent bbd5a0f commit 37eeda9

1 file changed

Lines changed: 7 additions & 31 deletions

File tree

.github/workflows/release-please.yml

Lines changed: 7 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ on:
66
workflow_dispatch:
77

88
permissions:
9-
actions: write
109
contents: write
1110
pull-requests: write
1211

@@ -21,40 +20,17 @@ jobs:
2120
- id: release
2221
uses: googleapis/release-please-action@v5
2322
with:
23+
token: ${{ secrets.RELEASE_PLEASE_TOKEN }}
2424
config-file: release-please-config.json
2525
manifest-file: .release-please-manifest.json
2626

27+
# Enable native auto-merge and stop; GitHub rebase-merges once the required
28+
# checks pass, and that PAT-authored merge is a push to main that both
29+
# re-triggers this workflow to cut the tag/release and triggers the deploy
30+
# (on: push), so no explicit deploy dispatch is needed here.
2731
- if: ${{ steps.release.outputs.pr }}
2832
env:
29-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
GH_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN }}
3034
REPO: ${{ github.repository }}
31-
WORKFLOW: ${{ github.workflow }}
3235
PR_JSON: ${{ steps.release.outputs.pr }}
33-
run: |
34-
PR=$(echo "$PR_JSON" | jq -r .number)
35-
BRANCH=$(echo "$PR_JSON" | jq -r .headBranchName)
36-
# Rebase-merge works when main has advanced past the release branch's
37-
# base. When the release commit already sits directly on main HEAD,
38-
# GitHub refuses ("This branch can't be rebased") on a rebase-only
39-
# repo — fast-forward main to the release commit via the API instead.
40-
gh pr merge --rebase --auto -R "$REPO" "$PR" \
41-
|| gh pr merge --rebase -R "$REPO" "$PR" \
42-
|| gh api -X PATCH "repos/$REPO/git/refs/heads/main" \
43-
-f sha="$(gh api "repos/$REPO/git/refs/heads/$BRANCH" --jq .object.sha)"
44-
for _ in $(seq 1 30); do
45-
STATE=$(gh pr view "$PR" -R "$REPO" --json state --jq .state)
46-
[ "$STATE" = "MERGED" ] && break
47-
sleep 2
48-
done
49-
gh api -X DELETE "repos/$REPO/git/refs/heads/$BRANCH" 2>/dev/null || true
50-
gh workflow run "$WORKFLOW" -R "$REPO" --ref main
51-
52-
# When a release is actually published, redeploy from main so the live
53-
# build carries the bumped version. release-please's own version-bump
54-
# commit is pushed by GITHUB_TOKEN and does NOT trigger the on:push deploy,
55-
# so the site would otherwise stay one release behind.
56-
- if: ${{ steps.release.outputs.release_created }}
57-
env:
58-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59-
REPO: ${{ github.repository }}
60-
run: gh workflow run deploy.yml -R "$REPO" --ref main
36+
run: gh pr merge --rebase --auto -R "$REPO" "$(echo "$PR_JSON" | jq -r .number)"

0 commit comments

Comments
 (0)