fix: too_many_open_prs() fails without SSO access
This commit is contained in:
parent
41be66fc2a
commit
4653d5889e
@ -921,25 +921,31 @@ module GitHub
|
|||||||
}
|
}
|
||||||
EOS
|
EOS
|
||||||
puts
|
puts
|
||||||
|
puts "In too_many_open_prs"
|
||||||
|
|
||||||
homebrew_prs_count = 0
|
homebrew_prs_count = 0
|
||||||
|
|
||||||
API.paginate_graphql(query) do |result|
|
begin
|
||||||
data = result.fetch("viewer")
|
API.paginate_graphql(query) do |result|
|
||||||
github_user = data.fetch("login")
|
data = result.fetch("viewer")
|
||||||
|
github_user = data.fetch("login")
|
||||||
|
|
||||||
# BrewTestBot can open as many PRs as it wants.
|
# BrewTestBot can open as many PRs as it wants.
|
||||||
return false if github_user.casecmp?("brewtestbot")
|
return false if github_user.casecmp?("brewtestbot")
|
||||||
|
|
||||||
pull_requests = data.fetch("pullRequests")
|
pull_requests = data.fetch("pullRequests")
|
||||||
return false if pull_requests.fetch("totalCount") < MAXIMUM_OPEN_PRS
|
return false if pull_requests.fetch("totalCount") < MAXIMUM_OPEN_PRS
|
||||||
|
|
||||||
homebrew_prs_count += pull_requests.fetch("nodes").count do |node|
|
homebrew_prs_count += pull_requests.fetch("nodes").count do |node|
|
||||||
node.dig("baseRepository", "owner", "login").casecmp?("homebrew")
|
node.dig("baseRepository", "owner", "login").casecmp?("homebrew")
|
||||||
|
end
|
||||||
|
return true if homebrew_prs_count >= MAXIMUM_OPEN_PRS
|
||||||
|
|
||||||
|
pull_requests.fetch("pageInfo")
|
||||||
end
|
end
|
||||||
return true if homebrew_prs_count >= MAXIMUM_OPEN_PRS
|
rescue => e
|
||||||
|
# Ignore SAML access errors (https://github.com/Homebrew/brew/issues/18610)
|
||||||
pull_requests.fetch("pageInfo")
|
raise unless e.message.casecmp?("SAML")
|
||||||
end
|
end
|
||||||
|
|
||||||
false
|
false
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user