Skip to content

Commit 8d64f6c

Browse files
authored
fix(gha): flip merged release PR label to autorelease: tagged (#302)
1 parent 955204a commit 8d64f6c

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ jobs:
320320
runs-on: ubuntu-latest
321321
permissions:
322322
contents: write
323+
pull-requests: write
323324
needs:
324325
- prepare-release
325326
- integration_test
@@ -347,6 +348,22 @@ jobs:
347348
run: pnpm run release-github
348349
env:
349350
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
351+
- name: Mark merged release PR as tagged
352+
# skip-github-release in release-please-config.json means release-please
353+
# never sees this release finalized, so it never flips the merged release
354+
# PR's label from "autorelease: pending" to "autorelease: tagged" itself.
355+
# Without this, release-please permanently refuses to open the next
356+
# release PR ("There are untagged, merged release PRs outstanding").
357+
# The "autorelease: tagged" label itself is created once, repo-wide.
358+
env:
359+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
360+
run: |
361+
pr=$(gh api "repos/${{ github.repository }}/commits/${{ github.sha }}/pulls" --jq '.[0].number // empty')
362+
if [ -z "${pr}" ]; then
363+
echo "No pull request associated with ${{ github.sha }}, skipping relabel"
364+
exit 0
365+
fi
366+
gh pr edit "${pr}" --remove-label "autorelease: pending" --add-label "autorelease: tagged"
350367
351368
publish_release:
352369
permissions:

0 commit comments

Comments
 (0)