Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
timgcarlson opened this issue Oct 3, 2019 · 3 comments
Open

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

timgcarlson opened this issue Oct 3, 2019 · 3 comments

Comments

@timgcarlson
Copy link

timgcarlson commented Oct 3, 2019

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.

@timgcarlson
Copy link
Author

timgcarlson commented Oct 3, 2019

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.

@j-rewerts j-rewerts mentioned this issue Oct 8, 2019
@j-rewerts
Copy link
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.

@j-rewerts
Copy link
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants