Skip to content

Fail the release when the tag's GitHub release is already published - #10665

Merged
glen-84 merged 1 commit into
mainfrom
gai/require-draft-release-before-publish
Oct 22, 2026
Merged

glen-84 merged 1 commit into
mainfrom
gai/require-draft-release-before-publish

Conversation

@glen-84

@glen-84 glen-84 commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Summary

A release created through the GitHub UI instead of by pushing a tag is already published when the release workflow starts, and an immutable release can't take assets after publication. The workflow skipped draft creation for such a release, published every package, and only failed when attaching the assets at the end.

  • The create-draft job now fails when the tag's release exists and is not a draft. An existing draft is still reused, so re-running a release keeps working.
  • publish-nuget, publish-npm, publish-nitro-ops, and publish-aspire-nitro-ops now need create-draft, so a release that is already published when the run starts stops the run before anything is published. The build jobs still run alongside it.

Test plan

  • Ran the step's script against this repository: a tag with a published release (16.0.0) fails with the error, and a tag without a release goes on to create the draft.
  • Ran it with a stubbed gh that reports an existing draft: it reuses the draft and exits successfully.
  • actionlint reports no new findings for the workflow.

Copilot AI lite review requested due to automatic review settings October 22, 2026 10:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The release state is not revalidated before external publishing, leaving a race that can still cause partial publication.

1 open issue
What changed in this PR

Updates the release workflow to prevent package publishing when the tag already has a published GitHub release, while preserving reuse of existing draft releases.

Changes:

  • Detects published, draft, and absent releases.
  • Fails early for already-published releases.
  • Gates package and Nitro operation publishing on successful draft preparation.
File Description
.github/​workflows/​release.yml Adds release-state validation and gates publishing jobs on successful draft validation.

Review effort: Lite

Comment thread .github/workflows/release.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants