-
Is there a way to "stream" the results of API calls without having to somehow implement manual pagination for My goal is to get a list of repositories that do not have a certain file in them and create and push that file if that is the case. The API command seems like a good fit to get the initial list of those repositories. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
@sirwindfield Yes, you have several options to avoid manual pagination:
|
Beta Was this translation helpful? Give feedback.
@sirwindfield Yes, you have several options to avoid manual pagination:
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.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 anendCursor
input variable and that it selectspageInfo{hasNextPage,endCursor}
in your collection. Seegh help api
for more information.