Skip to content

"GET /repos/{owner}/{repo}/commits/{ref}" can paginate the "files" property #155

@gr2m

Description

@gr2m

See https://docs.github.com/en/rest/reference/repos#get-a-commit

If there are more than 300 files in the commit diff, the response will include pagination link headers for the remaining files, up to a limit of 3000 files. Each page contains the static commit information, and the only changes are to the file listing.

It's an odd case. Only the "files" key array will be paginated, but unlike the other endpoints that paginate that return an object instead of an array, this one will include lots of other keys. I'm not sure if that case is covered by https://github.com/octokit/plugin-paginate-rest.js/blob/92ed1aab99fe8045fe2c23b21308390471d0c8f5/src/normalize-paginated-list-response.ts

If someone would like to give this a go, I'd be happy to advice. Comment below if you have any questions. The first step would be to add a test to https://github.com/octokit/plugin-paginate-rest.js/blob/master/test/paginate.test.ts, then start a pull request. We can continue the discussion there

Metadata

Metadata

Assignees

No one assigned

    Labels

    Good first issueGood for contributors new to OctokitStatus: Up for grabsIssues that are ready to be worked on by anyoneType: FeatureNew feature or request

    Projects

    Status

    🔥 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions