Skip to content

Optimization: Short-circuit release pagination for baseline selection #91

@joshjohanning

Description

@joshjohanning

The release notes baseline selection currently uses octokit.paginate() to fetch all releases, then filters/sorts client-side to find the highest semver tag less than the current version.

For repos with many releases (e.g. 200+), this means multiple API calls to fetch all pages even though the answer is likely on the first page.

Potential optimization

Use octokit.paginate.iterator() to process pages one at a time and short-circuit early once we've confidently found the best candidate:

let previousTag;
for await (const { data: page } of octokit.paginate.iterator(octokit.rest.repos.listReleases, { ... })) {
  // process page, track best candidate
  // break early if we can determine no better candidate exists on later pages
}

Priority

Low — for most repos this is 1-2 API calls total and the current approach is simple and correct. Only worth doing if repos with hundreds of releases become common consumers.

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions