perf: optimize release pagination with paginate.iterator() and early termination#93
Merged
Merged
Conversation
Replace octokit.paginate() with octokit.paginate.iterator() for release baseline selection. Processes pages one at a time and breaks early once a candidate is found and a subsequent page yields no improvement. Bump version to 3.1.1 (patch). Agent-Logs-Url: https://github.com/joshjohanning/publish-github-action/sessions/03c9f543-69e7-4518-9ebb-84d8315725f2 Co-authored-by: joshjohanning <19912012+joshjohanning@users.noreply.github.com>
Agent-Logs-Url: https://github.com/joshjohanning/publish-github-action/sessions/03c9f543-69e7-4518-9ebb-84d8315725f2 Co-authored-by: joshjohanning <19912012+joshjohanning@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Optimize short-circuit release pagination for baseline selection
Optimize release pagination with paginate.iterator() and early termination
Apr 16, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves release baseline selection performance in the Node.js GitHub Action by switching from fetching all release pages up front to iterating through release pages incrementally, aiming to reduce unnecessary GitHub API calls on repos with many releases.
Changes:
- Update release baseline selection to use
octokit.paginate.iterator()instead ofoctokit.paginate(). - Update Jest tests to mock
paginate.iterator()via an async generator helper. - Bump package version from
3.1.0to3.1.1(and sync lockfile / coverage badge).
Show a summary per file
| File | Description |
|---|---|
src/index.js |
Iterates release pages incrementally to find the best previous semver tag (adds early-termination logic). |
__tests__/index.test.js |
Adds paginate.iterator mocking and updates release-baseline tests to use async page iteration. |
package.json |
Version bump to 3.1.1. |
package-lock.json |
Lockfile version sync to 3.1.1. |
badges/coverage.svg |
Coverage badge updated to latest coverage percentage. |
Copilot's findings
- Files reviewed: 3/5 changed files
- Comments generated: 2
Validates that paginate.iterator() correctly finds the best semver candidate across multiple pages with early termination.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Release baseline selection fetched all release pages via
octokit.paginate()before filtering. For repos with many releases, this means unnecessary API calls when the answer is typically on page 1.Changes
src/index.js: Replaceoctokit.paginate()withoctokit.paginate.iterator()— processes pages incrementally and breaks early when a page yields no better candidate than what we already have__tests__/index.test.js: Addpaginate.iteratormock +asyncPagesasync generator helper; update 5 release-related tests to use iterator mockspackage.json: Bump 3.1.0 → 3.1.1Short-circuit relies on GitHub's default newest-first ordering — if a page has candidates but none beat our current best, older pages won't either in the typical case.