Skip to content

fix(release): guard publish job against duplicate GitHub releases#610

Merged
tolzhabayev merged 1 commit into
mainfrom
fix/release-duplicate-guard
Jun 9, 2026
Merged

fix(release): guard publish job against duplicate GitHub releases#610
tolzhabayev merged 1 commit into
mainfrom
fix/release-duplicate-guard

Conversation

@tolzhabayev

@tolzhabayev tolzhabayev commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

.goreleaser.yaml uses use_existing_draft: true to adopt the draft release-please creates, then publishes it. If that draft is missing at runtime (e.g. a failed release-to-github job that's later re-run), GoReleaser creates a new release instead — which is how plugin-validator/v0.42.8 got two releases for one tag (orphaned draft + published-without-notes).

Add a pre-flight guard before GoReleaser:

  • published release already exists -> skip GoReleaser (re-runs can't duplicate)
  • exactly one draft -> proceed (adopt it)
  • zero / multiple drafts -> fail fast

Uses gh api --jq (already on the runner) with the existing App token.

Test plan

  • zizmor --offline passes
  • Guard logic verified against the live API for v0.42.8 (drafts=0, published=1 -> skips, no duplicate)
  • CI green

GoReleaser adopts release-please's draft release via use_existing_draft.
When that draft is absent at runtime (e.g. a failed publish that is later
retried), GoReleaser silently creates a brand-new release instead. That is
how plugin-validator/v0.42.8 ended up with two releases for one tag: an
orphaned draft with the changelog and no binaries, plus a published release
with the binaries and no notes.

Add a pre-flight guard to the release-to-github job that inspects existing
releases for the tag and:
  - skips GoReleaser when a published release already exists (idempotent
    re-runs can no longer create a duplicate),
  - fails fast when no draft exists rather than letting GoReleaser create a
    fresh release,
  - fails on multiple drafts so the ambiguity is resolved by a human.
@tolzhabayev tolzhabayev requested a review from a team as a code owner June 8, 2026 17:00
@tolzhabayev tolzhabayev self-assigned this Jun 8, 2026
@grafana-catalog-project-bot grafana-catalog-project-bot Bot moved this from 📬 Triage to 🔬 In review in Grafana Catalog Team Jun 8, 2026
@tolzhabayev tolzhabayev requested a review from academo June 8, 2026 17:04
@tolzhabayev tolzhabayev merged commit d576630 into main Jun 9, 2026
11 checks passed
@tolzhabayev tolzhabayev deleted the fix/release-duplicate-guard branch June 9, 2026 12:51
@github-project-automation github-project-automation Bot moved this from 🔬 In review to 🚀 Shipped in Grafana Catalog Team Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🚀 Shipped

Development

Successfully merging this pull request may close these issues.

3 participants