dev-cmd/contributions: Avoid the /users/#{user}/events API call
- This is wasteful when we can just catch the `ValidationFailedError` from the GitHub API from the search query.
This commit is contained in:
parent
0a804e1b38
commit
b6198cdd07
@ -207,9 +207,8 @@ module Homebrew
|
||||
|
||||
sig { params(repo_full_name: String, person: String, args: Homebrew::CLI::Args).returns(Integer) }
|
||||
def count_reviews(repo_full_name, person, args)
|
||||
# Users who have made their contributions private are not searchable to determine counts.
|
||||
return 0 if GitHub::API.open_rest("https://api.github.com/users/#{person}/events").empty?
|
||||
|
||||
GitHub.count_issues("", is: "pr", repo: repo_full_name, reviewed_by: person, review: "approved", args: args)
|
||||
rescue GitHub::API::ValidationFailedError
|
||||
0 # Users who have made their contributions private are not searchable to determine counts.
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user