Skip to content

ci: skip release PR generation when a release was just created - #3120

Merged
afonsojramos merged 1 commit into
mainfrom
ci/fix-release-pr-gate
Jul 29, 2026
Merged

ci: skip release PR generation when a release was just created#3120
afonsojramos merged 1 commit into
mainfrom
ci/fix-release-pr-gate

Conversation

@afonsojramos

Copy link
Copy Markdown
Member

What happened

Merging the 7.2.0 release PR created a bogus 7.3.0 PR (#3119) whose changelog regenerates from months-old commits — the same failure #3108 was meant to prevent.

Timeline from the run:

21:37:18.9  ✔ Creating 1 releases for pull #3111      <- v7.2.0 draft created
21:37:21.3  Run count=$(gh api .../releases ...)      <- draft gate: reported 0
21:38:38.4  ⚠ No latest release pull request found    <- cannot anchor
21:38:50.3  ✔ Successfully opened pull request: 3119  <- bogus 7.3.0

Two distinct problems:

  1. The gate raced. ci: defer release-please PR creation while a draft release is pending #3108 checks for pending draft releases via gh api .../releases, but that check runs ~2 seconds after phase 1 creates the draft, and the list endpoint hadn't reflected it yet. Zero drafts reported, so the release-PR phase ran.
  2. Without a tag, release-please can't anchor. A draft release has no git tag (v7.2.0 is a 404 right now), so release-please logs "No latest release pull request found" and rebuilds the changelog from the beginning of history.

Changes

  1. Gate on release-please's own output rather than an API read:

    if: ${{ steps.release.outputs.release_created != 'true' && steps.drafts.outputs.count == '0' }}

    release_created comes from the same action invocation that created the draft, so it cannot race. The existing draft-count check is kept as the second condition — it covers drafts left pending by earlier runs, where the API has long since caught up.

  2. concurrency group on the workflow. Releases now serialise. Overlapping runs are how the sibling repo ended up with a version tagged on GitHub but never published to npm, and this workflow had no protection against it.

Effect

Scenario Release PR phase
Release PR merged (draft created) skipped — release_created == 'true'
Any push while a draft is pending skipped — draft count ≥ 1
Draft published, tag exists runs, and anchors correctly

#3119 should be closed; it will be regenerated correctly once v7.2.0 publishes and its tag materialises.

@afonsojramos
afonsojramos requested a review from setchy as a code owner July 29, 2026 21:43
@github-actions github-actions Bot added the build Build, action or package manager changes label Jul 29, 2026
@sonarqubecloud

Copy link
Copy Markdown

@afonsojramos
afonsojramos merged commit 4fc6f83 into main Jul 29, 2026
16 checks passed
@afonsojramos
afonsojramos deleted the ci/fix-release-pr-gate branch July 29, 2026 21:56
@github-actions github-actions Bot added this to the Release 7.x.x milestone Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Build, action or package manager changes

Development

Successfully merging this pull request may close these issues.

1 participant