Skip to content
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

fix: ignore SAML issues in GH API #17662

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Library/Homebrew/utils/github.rb
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,8 @@ def self.too_many_open_prs?(tap)
return false if !more_graphql_data && prs.length < MAXIMUM_OPEN_PRS

homebrew_prs_count = graphql_result.dig("viewer", "pullRequests", "nodes").count do |pr|
next unless pr.present?

pr["headRepositoryOwner"]["login"] == "Homebrew"
end
return true if homebrew_prs_count >= MAXIMUM_OPEN_PRS
Expand Down
11 changes: 10 additions & 1 deletion Library/Homebrew/utils/github/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,16 @@ def self.open_graphql(query, variables: nil, scopes: [].freeze, raise_errors: tr

if raise_errors
if result["errors"].present?
raise Error, result["errors"].map { |e| "#{e["type"]}: #{e["message"]}" }.join("\n")
related_errors = result["errors"].reject do |e|
# comment explaining why we don't care about saml_failure
SMillerDev marked this conversation as resolved.
Show resolved Hide resolved
e.dig("extensions", "saml_failure") == true
end

if related_errors.present?
raise Error, related_errors.map { |e|
"#{e["type"]}: #{e["message"]}"
}.join("\n")
end
end

result["data"]
Expand Down
Loading