Skip to content

fix: use getReleaseByTag API instead of iterating all releases#725

Merged
chenrui333 merged 2 commits intosoftprops:masterfrom
kim-em:fix-10k-releases-limit
Mar 14, 2026
Merged

fix: use getReleaseByTag API instead of iterating all releases#725
chenrui333 merged 2 commits intosoftprops:masterfrom
kim-em:fix-10k-releases-limit

Conversation

@kim-em
Copy link
Copy Markdown
Contributor

@kim-em kim-em commented Jan 27, 2026

Summary

This PR fixes #724 by using the direct getReleaseByTag API instead of iterating through all releases.

Problem

The findTagFromReleases function previously iterated through all releases using allReleases() to find a matching tag. This fails when the repository has more than 10,000 releases due to GitHub's API pagination limit:

⚠️ Unexpected error fetching GitHub release for tag refs/heads/master: HttpError: Only the first 10000 results are available.

Solution

The GitHubReleaser class already has a getReleaseByTag method that fetches a release directly by tag. This PR updates findTagFromReleases to use this direct lookup:

  • O(1) API call instead of O(n) paginated calls
  • No pagination limit issues
  • More efficient for all users

Changes

  • src/github.ts: Updated findTagFromReleases to use getReleaseByTag with proper 404 handling
  • __tests__/github.test.ts: Updated tests to reflect the new implementation
  • dist/index.js: Rebuilt

Testing

All existing tests pass. Updated the findTagFromReleases tests to verify:

  • Direct tag lookup works
  • Returns undefined for 404 (release not found)
  • Re-throws non-404 errors
  • Works with empty tag names

closes #724

kim-em and others added 2 commits March 14, 2026 19:55
This avoids GitHub's API pagination limit of 10000 results which causes
failures for repositories with many releases.

The `findTagFromReleases` function now uses the direct `getReleaseByTag`
API for O(1) lookup instead of iterating through all releases with
`allReleases`. This is both more efficient and fixes the 10k limit issue.

Fixes softprops#724
Signed-off-by: Rui Chen <rui@chenrui.dev>
@chenrui333 chenrui333 force-pushed the fix-10k-releases-limit branch from 7aa1b12 to ff862f5 Compare March 14, 2026 23:56
@chenrui333 chenrui333 merged commit 320a0be into softprops:master Mar 14, 2026
1 check passed
@chenrui333
Copy link
Copy Markdown
Collaborator

Thanks @kim-em!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

findTagFromReleases fails with >10000 releases due to API pagination limit

2 participants