bump-*-pr: check existing PRs for exact file match
This commit is contained in:
parent
4e79550b03
commit
1395259ad6
@ -200,13 +200,10 @@ module Homebrew
|
||||
end
|
||||
|
||||
def check_open_pull_requests(cask, tap_full_name, args:)
|
||||
GitHub.check_for_duplicate_pull_requests(cask.token, tap_full_name, state: "open", args: args)
|
||||
end
|
||||
|
||||
def check_closed_pull_requests(cask, tap_full_name, version:, args:)
|
||||
# if we haven't already found open requests, try for an exact match across closed requests
|
||||
pr_title = "Update #{cask.token} from #{cask.version} to #{version}"
|
||||
GitHub.check_for_duplicate_pull_requests(pr_title, tap_full_name, state: "closed", args: args)
|
||||
GitHub.check_for_duplicate_pull_requests(cask.token, tap_full_name,
|
||||
state: "open",
|
||||
file: cask.sourcefile_path.relative_path_from(cask.tap.path).to_s,
|
||||
args: args)
|
||||
end
|
||||
|
||||
def run_cask_audit(cask, old_contents, args:)
|
||||
|
||||
@ -460,7 +460,10 @@ args: args)
|
||||
end
|
||||
|
||||
def check_open_pull_requests(formula, tap_full_name, args:)
|
||||
GitHub.check_for_duplicate_pull_requests(formula.name, tap_full_name, state: "open", args: args)
|
||||
GitHub.check_for_duplicate_pull_requests(formula.name, tap_full_name,
|
||||
state: "open",
|
||||
file: formula.path.relative_path_from(formula.tap.path).to_s,
|
||||
args: args)
|
||||
end
|
||||
|
||||
def check_closed_pull_requests(formula, tap_full_name, args:, version: nil, url: nil, tag: nil)
|
||||
@ -470,7 +473,10 @@ args: args)
|
||||
version = Version.detect(url, **specs)
|
||||
end
|
||||
# if we haven't already found open requests, try for an exact match across closed requests
|
||||
GitHub.check_for_duplicate_pull_requests("#{formula.name} #{version}", tap_full_name, state: "closed", args: args)
|
||||
GitHub.check_for_duplicate_pull_requests("#{formula.name} #{version}", tap_full_name,
|
||||
state: "closed",
|
||||
file: formula.path.relative_path_from(formula.tap.path).to_s,
|
||||
args: args)
|
||||
end
|
||||
|
||||
def alias_update_pair(formula, new_formula_version)
|
||||
|
||||
@ -628,8 +628,12 @@ module GitHub
|
||||
[]
|
||||
end
|
||||
|
||||
def check_for_duplicate_pull_requests(query, tap_full_name, state:, args:)
|
||||
def check_for_duplicate_pull_requests(query, tap_full_name, state:, file:, args:)
|
||||
pull_requests = fetch_pull_requests(query, tap_full_name, state: state)
|
||||
pull_requests.select! do |pr|
|
||||
pr_files = open_api(url_to("repos", tap_full_name, "pulls", pr["number"], "files"))
|
||||
pr_files.any? { |f| f["filename"] == file }
|
||||
end
|
||||
return if pull_requests.blank?
|
||||
|
||||
duplicates_message = <<~EOS
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user