Skip to content

Listing all repositories using api without manual pagination #3257

Answered by mislav
mainrs asked this question in Q&A
Discussion options

You must be logged in to vote

@sirwindfield Yes, you have several options to avoid manual pagination:

  1. You can list repositories using gh repo list --limit 9999. Just make sure you specify the large enough maximum limit to include all your repositories.

  2. You can use gh api --paginate. Note that multiple JSON documents will be returned on stdout, but you can add the --jq parameter to select a specific field to be printed as plain text. For GraphQL requests, pagination requires that your query accepts an endCursor input variable and that it selects pageInfo{hasNextPage,endCursor} in your collection. See gh help api for more information.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by mainrs
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants