dev-cmd/bump: Don't fall over when retrieving PRs errors

- Instead, let the `pull_requests&.any?` check do its job and not show
  PRs that we couldn't find or fetch.
- In the `--debug` output, show the error message that we got from GitHub.
This commit is contained in:
Issy Long 2024-01-19 19:46:30 +00:00
parent 36024e2a4d
commit de6ec7c54e
No known key found for this signature in database
GPG Key ID: 8247C390DADC67D4

View File

@ -288,7 +288,12 @@ 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)
begin
pull_requests = 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}"
end
if pull_requests&.any?
pull_requests = pull_requests.map { |pr| "#{pr["title"]} (#{Formatter.url(pr["html_url"])})" }.join(", ")
end