Skip to content

ci: fix notify-registry draft-state release lookup#10

Merged
intel352 merged 1 commit into
mainfrom
ci/notify-registry-draft-lookup
May 17, 2026
Merged

ci: fix notify-registry draft-state release lookup#10
intel352 merged 1 commit into
mainfrom
ci/notify-registry-draft-lookup

Conversation

@intel352
Copy link
Copy Markdown
Contributor

Summary

Fixes recurring notify-registry failure across plugin release workflows: Publish GitHub release step uses github.rest.repos.getReleaseByTag which returns 404 for DRAFT releases. GoReleaser config creates releases as draft → step fails on every release.

Root cause

getReleaseByTag only returns published (non-draft) releases. Drafts have no tag indexing — accessible only by release ID. GoReleaser-created draft race the post-release script.

Fix

Replace with listReleases (which DOES return drafts) + find by tag. Single deterministic API call; no 404-on-draft race.

Affected workflow files (this PR)

.github/workflows/release.yml notify-registry job, Publish GitHub release step.

Sibling PRs (same fix, ~9 repos affected)

This is one of 9 coordinated PRs fixing the identical bug pattern across plugin repos. Other repos: workflow-plugin-{gcp, azure, authz, authz-ui, bento, security, supply-chain, agent, tofu}.

Test plan

  • YAML parses cleanly
  • Next release tag exercises the fixed path (verify the publish step succeeds)

Rollback

Revert commit. Defensive change; no other code paths touched.

Root cause (recurring across plugin repos): the "Publish GitHub release"
step in notify-registry job uses github.rest.repos.getReleaseByTag which
returns 404 for DRAFT releases — drafts are NOT accessible by tag name,
only by release ID. GoReleaser config creates releases as draft → step
fails on every release.

Symptoms observed:
- workflow-plugin-authz run 25950232345 (v0.5.4, 2026-05-16) — flagged
- workflow-plugin-azure run 25989195581 (v1.2.1, 2026-05-17) — Phase 2.5+
  cleanup bundle hit this; defensive `gh release edit --draft=false`
  applied post-fact
- workflow-plugin-azure v1.2.0 (Phase 2 cascade, 2026-05-16) — same
- Likely affects every release in repos with this workflow pattern

Fix: replace getReleaseByTag with listReleases + find by tag (drafts
ARE returned by listReleases). Single deterministic API call; no
404-on-draft race.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a recurring failure in the release workflow where the “Publish GitHub release” step attempted to fetch a release by tag using an endpoint that returns 404 for draft releases created by GoReleaser.

Changes:

  • Replace repos.getReleaseByTag with repos.listReleases and locate the release by tag_name (covers draft releases).
  • Add an explicit error when the tag is not found in the returned release list.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 48 to +52
const tag = context.ref.replace('refs/tags/', '');
const { owner, repo } = context.repo;
const { data: release } = await github.rest.repos.getReleaseByTag({ owner, repo, tag });
// listReleases returns drafts; getReleaseByTag 404s on drafts. GoReleaser
// creates releases as draft; this step flips them to non-draft post-publish.
const { data: releases } = await github.rest.repos.listReleases({ owner, repo, per_page: 100 });
Comment on lines +52 to +56
const { data: releases } = await github.rest.repos.listReleases({ owner, repo, per_page: 100 });
const release = releases.find(r => r.tag_name === tag);
if (!release) {
throw new Error(`release for tag ${tag} not found in repo listing (latest 100 releases)`);
}
@intel352 intel352 merged commit b26a71b into main May 17, 2026
8 checks passed
@intel352 intel352 deleted the ci/notify-registry-draft-lookup branch May 17, 2026 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants