Skip to content

Conversation

@tzing0013
Copy link

To get the total number of records by setting per page 1. But the GitHub v3 API is returning ONLY the "next" page (&page=2), so LastPage will be zero since rel="last" is not returned from the API call. That make the issue count zero all the time.

Get issue count with GitHub Search API

Signed-off-by: tzing_t <[email protected]>
@calebbrown
Copy link
Contributor

Thanks for the contribution!

I need to take a look to understand how the switch to the search API changes things.

This change is okay for one-off runs of Criticality Score, but when running it in a batch job we will quickly chew through search query quota, which is separate to REST quota in general.

@tzing0013
Copy link
Author

Thanks for the contribution!

I need to take a look to understand how the switch to the search API changes things.

This change is okay for one-off runs of Criticality Score, but when running it in a batch job we will quickly chew through search query quota, which is separate to REST quota in general.

I really didn't consider the quota. For REST, the only way I know is the loop in next page, so I change it to search API. Is there any other better way for the count, it's honor to learn it.

May get the count with GraphQL API, The lib go-github recommends the library shurcooL/githubv4 for GraphQL.

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

Successfully merging this pull request may close these issues.

2 participants