Merge pull request #19670 from Homebrew/bump_warn_unofficial_taps

dev-cmd/bump-*: only warn on duplicate PRs for official taps.
This commit is contained in:
Patrick Linnane 2025-04-01 16:18:22 +00:00 committed by GitHub
commit 39afba427e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 6 deletions

View File

@ -264,8 +264,9 @@ module Homebrew
file = cask.sourcefile_path.relative_path_from(cask.tap.path).to_s file = cask.sourcefile_path.relative_path_from(cask.tap.path).to_s
quiet = args.quiet? quiet = args.quiet?
official_tap = cask.tap.official?
GitHub.check_for_duplicate_pull_requests(cask.token, tap_remote_repo, GitHub.check_for_duplicate_pull_requests(cask.token, tap_remote_repo,
state: "open", file:, quiet:) state: "open", file:, quiet:, official_tap:)
# if we haven't already found open requests, try for an exact match across all pull requests # if we haven't already found open requests, try for an exact match across all pull requests
new_version.instance_variables.each do |version_type| new_version.instance_variables.each do |version_type|
@ -273,7 +274,8 @@ module Homebrew
next if version_type_version.blank? next if version_type_version.blank?
version = shortened_version(version_type_version, cask:) version = shortened_version(version_type_version, cask:)
GitHub.check_for_duplicate_pull_requests(cask.token, tap_remote_repo, version:, file:, quiet:) GitHub.check_for_duplicate_pull_requests(cask.token, tap_remote_repo, version:,
file:, quiet:, official_tap:)
end end
end end

View File

@ -550,8 +550,9 @@ module Homebrew
formula.name, tap_remote_repo, formula.name, tap_remote_repo,
version:, version:,
state:, state:,
file: formula.path.relative_path_from(tap.path).to_s, file: formula.path.relative_path_from(tap.path).to_s,
quiet: args.quiet? quiet: args.quiet?,
official_tap: tap.official?
) )
end end

View File

@ -635,9 +635,11 @@ module GitHub
quiet: T::Boolean, quiet: T::Boolean,
state: T.nilable(String), state: T.nilable(String),
version: T.nilable(String), version: T.nilable(String),
official_tap: T::Boolean,
).void ).void
} }
def self.check_for_duplicate_pull_requests(name, tap_remote_repo, file:, quiet: false, state: nil, version: nil) def self.check_for_duplicate_pull_requests(name, tap_remote_repo, file:, quiet: false, state: nil,
version: nil, official_tap: true)
pull_requests = fetch_pull_requests(name, tap_remote_repo, state:, version:) pull_requests = fetch_pull_requests(name, tap_remote_repo, state:, version:)
pull_requests.select! do |pr| pull_requests.select! do |pr|
@ -657,7 +659,9 @@ module GitHub
Manually open these PRs if you are sure that they are not duplicates (and tell us that in the PR). Manually open these PRs if you are sure that they are not duplicates (and tell us that in the PR).
EOS EOS
if version if !official_tap
opoo duplicates_message
elsif version
odie <<~EOS odie <<~EOS
#{duplicates_message.chomp} #{duplicates_message.chomp}
#{error_message} #{error_message}