Skip to content

[FEAT]: Add pagination support for compareCommitsWithBasehead() #647

@LykinsN

Description

What happened?

Our team is using the @octokit/rest library to handle several different calls to our private GHE platform and we are using the paginate wrapper to handle larger datasets. This functionality is working on several other API calls (i.e. listPullRequestsAssociatedWithCommit, listBranches, etc) but is not working correctly with the compareCommitsWithBasehead call. For example, if I reference two branches in the following snippet:

import { Octokit } from '@octokit/rest';
...
const octokit = new Octokit({ auth: githubToken, baseUrl: githubBaseUrl });
...
const data = await octokit.paginate(
   octokit.rest.repos.compareCommitsWithBasehead,
  {
    owner: githubOwner,
    repo: githubRepo,
    basehead: `${branchOne}...${branchTwo}`,
  },
);

If this results in more than 250 records, I'd expect to get the full set back, i.e. 500. But instead, the call only seems to return a single page, and only returns the maximum allowed number from the compareCommitsWithBasehead API call. I've been able to write a custom pagination handler to do the work for me in this case, but I'd expect the paginate wrapper should handle it as well.

Versions

@octokit/rest: v20.1.0, Node: v18.20.4

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

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

Metadata

Assignees

No one assigned

    Labels

    Projects

    • Status

      🔥 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions