8000 Fix issue count error by tzing0013 · Pull Request #817 · ossf/criticality_score · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix issue count error #817

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

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 <zhengting13@huawei.com>
@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
0