Skip to content

GHCommit.getFiles() limited to 300 files, does not support pagination #1669

@bitwiseman

Description

@bitwiseman

Describe the bug
https://docs.github.com/en/rest/commits/commits?apiVersion=2022-11-28#get-a-commit

Note: 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.

Except hub4j doesn't support pagination at this time:

public List<File> getFiles() throws IOException {
populate();
return files != null ? Collections.unmodifiableList(files) : Collections.<File>emptyList();
}

To Reproduce
Steps to reproduce the behavior:

  1. Use GHCommit.getFiles() on a commit with more than 300 files changed.

Expected behavior
Suggest deprecating getFiles() and adding a listFile() that returns a PagedIterable. However, I think that PagedIterable will need to be backed by a custom class similar to GHWorkflowsIterable with the GHCommit as the container. It's going to take some trial-and-error to figure out how this works.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions