Skip to content

Use list-releases endpoint to find draft releases by tag - #298

Merged
jeduden merged 1 commit into
mainfrom
claude/fix-release-publishing-S6iPt
May 15, 2026
Merged

Use list-releases endpoint to find draft releases by tag#298
jeduden merged 1 commit into
mainfrom
claude/fix-release-publishing-S6iPt

Conversation

@jeduden

@jeduden jeduden commented May 15, 2026

Copy link
Copy Markdown
Owner

Summary

Changes the release lookup logic to use the GitHub list-releases endpoint instead of the by-tag endpoint. This is necessary because the by-tag endpoint deliberately omits draft releases, but the release job creates releases as drafts to keep assets mutable until final publication.

Key Changes

  • Removed direct by-tag lookup: Replaced the single GET /releases/tags/{tag} request with pagination through the list-releases endpoint
  • Added pagination support: Implemented nextPageURL() helper to parse GitHub's Link header and follow pagination to find draft releases that may not appear on the first page
  • Split lookup logic: Extracted lookupReleasePage() to handle individual page requests and tag matching
  • Updated releaseRef struct: Added TagName field to support matching releases by tag name when iterating through paginated results
  • Removed net/url import: No longer needed since we're not using url.PathEscape()

Implementation Details

  • The lookupReleaseRef() function now loops through paginated results, calling lookupReleasePage() for each page
  • lookupReleasePage() decodes a list of releases and searches for a matching tag name, returning the next page URL from the Link header
  • nextPageURL() parses the RFC 5988 Link header format to extract the rel="next" URL for pagination
  • All tests updated to reflect the new list-based response format and pagination behavior
  • Added TestPublishReleaseFollowsPaginationToFindDraft() to verify pagination works correctly
  • Added TestNextPageURL() to unit test the Link header parsing logic

https://claude.ai/code/session_01F3gFEBvZLjWfAuoqcMNoSZ

The release job creates the GitHub release as a draft so assets
stay mutable until the final publish. GitHub's
GET /releases/tags/{tag} endpoint omits draft releases, so the
by-tag lookup always 404'd and publish-release could never find
the draft to flip — failing every release with "no GitHub
release found for tag".

List releases via GET /releases and match on tag_name (drafts
are only visible there), following Link-header pagination since
a fresh draft is not guaranteed to land on the first page.

https://claude.ai/code/session_01F3gFEBvZLjWfAuoqcMNoSZ
Copilot AI review requested due to automatic review settings May 15, 2026 22:27

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.

Pull request overview

Switches GitHub release lookup from the by-tag endpoint to the list-releases endpoint so that draft releases (which the by-tag endpoint hides) can be discovered, with Link-header pagination support to handle workspaces where the draft is not on page 1.

Changes:

  • Replace GET /releases/tags/{tag} with paginated GET /releases?per_page=100, matching by tag_name.
  • Add nextPageURL() helper to parse the RFC 5988 Link header for rel="next".
  • Update tests to return list responses and add coverage for pagination and Link parsing.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
internal/release/publishrelease.go Replaces by-tag GET with paginated list-releases lookup; adds lookupReleasePage and nextPageURL; adds TagName to releaseRef; drops net/url.
internal/release/publishrelease_test.go Updates existing tests to list-shaped JSON; adds pagination and Link-header parsing tests.
cmd/mdsmith-release/publishrelease_test.go Updates lookup response to list shape with tag_name.

@codecov

codecov Bot commented May 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.08%. Comparing base (318f1ba) to head (25e34c9).

Additional details and impacted files
Components Coverage Δ
Go 96.04% <100.00%> (+<0.01%) ⬆️
TypeScript 99.35% <ø> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jeduden
jeduden merged commit 8becec1 into main May 15, 2026
23 checks passed
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.

3 participants