Skip to content

listBranches() does not return all branches in a repository #592

Open

Description

@timgcarlson

When using listBranches() on a repository with over 30 branches, I only get 30 branches in the response. The response includes the page information:

link: '<https://api.github.com/repositories/0000000/branches?page=2>; rel="next", <https://api.github.com/repositories/0000000/branches?page=2>; rel="last"',

However, I do not see a way to include options on the listBranches() function. Is it currently possible to get back all the branches in the repository?

EDIT: This might be a duplicate of this feature request.

Activity

  1. timgcarlson commented on Oct 3, 2019

    @timgcarlson
    Author

    I'm able to get all the branches if I use _requestAllPages and __fullname:

    let repo = githubApi.getRepo(user, repo)
    repo._requestAllPages(`/repos/${this._repo.__fullname}/branches`, { AcceptHeader: 'inertia-preview' })
        .then(response => console.log('all branches:', response.data));
    

    Is this going to be my only solution without updating this wrapper? I'm happy to submit a PR if this is a feature that could be added. Perhaps including an option to use _requestAllPages when needed, but defaulting to not use it to avoid rate limits.

  2. j-rewerts commented on Oct 8, 2019

    @j-rewerts
    Member

    This is related to a larger issue around paging. We have quite a few issues for paging, but I'd like to leave this open to ensure it gets dealt with. See #578.

  3. j-rewerts commented on Oct 8, 2019

    @j-rewerts
    Member

    PRs are welcome, btw! Also, discussion around how we're going to handle paging would be welcome. Comment in #578 if you're interested.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions