Merge pull request #16508 from issyl0/handle-auth-errors

dev-cmd/bump: Don't fall over when retrieving PRs 404s
This commit is contained in:
Issy Long 2024-01-21 19:54:43 +00:00 committed by GitHub
commit c5b35b87ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -288,7 +288,13 @@ module Homebrew
}
def retrieve_pull_requests(formula_or_cask, name, state:, version: nil)
tap_remote_repo = formula_or_cask.tap&.remote_repo || formula_or_cask.tap&.full_name
pull_requests = GitHub.fetch_pull_requests(name, tap_remote_repo, state: state, version: version)
pull_requests = begin
GitHub.fetch_pull_requests(name, tap_remote_repo, state: state, version: version)
rescue GitHub::API::ValidationFailedError => e
odebug "Error fetching pull requests for #{formula_or_cask} #{name}: #{e}"
nil
end
if pull_requests&.any?
pull_requests = pull_requests.map { |pr| "#{pr["title"]} (#{Formatter.url(pr["html_url"])})" }.join(", ")
end