fix: prevent stale release PR body by closing before regeneration

release-please skips updating the PR body when it finds an existing PR,
causing the changelog to miss commits that landed after the PR was
created. Fix by closing the stale PR before release-please runs so it
always creates a fresh PR with the full changelog.

Also set cancel-in-progress: true so rapid successive merges don't
race to create the PR with partial commit history.
This commit is contained in:
Trevin Chow
2026-03-18 01:28:09 -07:00
parent eaaba1928b
commit 9de830aa5b

View File

@@ -12,7 +12,7 @@ permissions:
concurrency:
group: release-pr-${{ github.ref }}
cancel-in-progress: false
cancel-in-progress: true
jobs:
release-pr:
@@ -37,6 +37,16 @@ jobs:
- name: Validate release metadata scripts
run: bun run release:validate
- name: Close stale release PR
run: |
PR=$(gh pr list --head release-please--branches--main --json number --jq '.[0].number')
if [ -n "$PR" ]; then
echo "Closing stale release PR #$PR so release-please regenerates with full changelog"
gh pr close "$PR" --delete-branch=false
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Maintain release PR
id: release
uses: googleapis/release-please-action@v4.4.0