From de6ec7c54eae3c44353dc83d20cc6161d3fea10b Mon Sep 17 00:00:00 2001 From: Issy Long Date: Fri, 19 Jan 2024 19:46:30 +0000 Subject: [PATCH 1/2] 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. --- Library/Homebrew/dev-cmd/bump.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/dev-cmd/bump.rb b/Library/Homebrew/dev-cmd/bump.rb index b6211f4145..24f1201b23 100644 --- a/Library/Homebrew/dev-cmd/bump.rb +++ b/Library/Homebrew/dev-cmd/bump.rb @@ -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 From 22203fb6d99857a678fb39b1903492c2eecebe61 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Sun, 21 Jan 2024 19:41:49 +0000 Subject: [PATCH 2/2] dev-cmd/bump: Be more explicit that we have no PRs Co-authored-by: Mike McQuaid --- Library/Homebrew/dev-cmd/bump.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/dev-cmd/bump.rb b/Library/Homebrew/dev-cmd/bump.rb index 24f1201b23..097973d83f 100644 --- a/Library/Homebrew/dev-cmd/bump.rb +++ b/Library/Homebrew/dev-cmd/bump.rb @@ -288,10 +288,11 @@ 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 - begin - 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?