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 all 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 @@

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|
# saml_failure only happens for other orgs, Homebrew doesn't have it
e.dig("extensions", "saml_failure") == true

Check warning on line 327 in Library/Homebrew/utils/github/api.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/utils/github/api.rb#L327

Added line #L327 was not covered by tests
end

if related_errors.present?
raise Error, related_errors.map { |e|
"#{e["type"]}: #{e["message"]}"

Check warning on line 332 in Library/Homebrew/utils/github/api.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/utils/github/api.rb#L332

Added line #L332 was not covered by tests
}.join("\n")
end
end

result["data"]
Expand Down