Merge pull request #20082 from alex/strict-check-for-duplicate-prs
Add strict parameter to `GitHub::check_for_duplicate_pull_requests`
This commit is contained in:
commit
1a5afaf739
@ -627,6 +627,12 @@ module GitHub
|
|||||||
pull_requests || []
|
pull_requests || []
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Check for duplicate pull requests that modify the same file.
|
||||||
|
#
|
||||||
|
# Exits the process on duplicates if `strict` or both `version` and
|
||||||
|
# `official_tap`, otherwise warns.
|
||||||
|
#
|
||||||
|
# @api internal
|
||||||
sig {
|
sig {
|
||||||
params(
|
params(
|
||||||
name: String,
|
name: String,
|
||||||
@ -636,10 +642,11 @@ module GitHub
|
|||||||
state: T.nilable(String),
|
state: T.nilable(String),
|
||||||
version: T.nilable(String),
|
version: T.nilable(String),
|
||||||
official_tap: T::Boolean,
|
official_tap: T::Boolean,
|
||||||
|
strict: T::Boolean,
|
||||||
).void
|
).void
|
||||||
}
|
}
|
||||||
def self.check_for_duplicate_pull_requests(name, tap_remote_repo, file:, quiet: false, state: nil,
|
def self.check_for_duplicate_pull_requests(name, tap_remote_repo, file:, quiet: false, state: nil,
|
||||||
version: nil, official_tap: true)
|
version: nil, official_tap: true, strict: false)
|
||||||
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|
|
||||||
@ -659,13 +666,13 @@ 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 !official_tap
|
if strict || (version && official_tap)
|
||||||
opoo duplicates_message
|
|
||||||
elsif version
|
|
||||||
odie <<~EOS
|
odie <<~EOS
|
||||||
#{duplicates_message.chomp}
|
#{duplicates_message.chomp}
|
||||||
#{error_message}
|
#{error_message}
|
||||||
EOS
|
EOS
|
||||||
|
elsif !official_tap
|
||||||
|
opoo duplicates_message
|
||||||
elsif quiet
|
elsif quiet
|
||||||
opoo error_message
|
opoo error_message
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user