bump-*-pr: check for valid tap
This commit is contained in:
parent
1395259ad6
commit
2901d2058a
@ -67,6 +67,10 @@ module Homebrew
|
||||
ENV["BROWSER"] = Homebrew::EnvConfig.browser
|
||||
|
||||
cask = args.named.to_casks.first
|
||||
|
||||
odie "This cask is not in a tap!" if cask.tap.blank?
|
||||
odie "This cask's tap is not a Git repository!" unless cask.tap.git?
|
||||
|
||||
new_version = args.version
|
||||
new_version = :latest if ["latest", ":latest"].include?(new_version)
|
||||
new_version = Cask::DSL::Version.new(new_version) if new_version.present?
|
||||
@ -81,12 +85,7 @@ module Homebrew
|
||||
old_version = cask.version
|
||||
old_hash = cask.sha256
|
||||
|
||||
tap_full_name = cask.tap&.full_name
|
||||
default_remote_branch = cask.tap.path.git_origin_branch if cask.tap
|
||||
default_remote_branch ||= "master"
|
||||
previous_branch = "-"
|
||||
|
||||
check_open_pull_requests(cask, tap_full_name, args: args)
|
||||
check_open_pull_requests(cask, args: args)
|
||||
|
||||
old_contents = File.read(cask.sourcefile_path)
|
||||
|
||||
@ -180,12 +179,9 @@ module Homebrew
|
||||
pr_info = {
|
||||
sourcefile_path: cask.sourcefile_path,
|
||||
old_contents: old_contents,
|
||||
remote_branch: default_remote_branch,
|
||||
branch_name: branch_name,
|
||||
commit_message: commit_message,
|
||||
previous_branch: previous_branch,
|
||||
tap: cask.tap,
|
||||
tap_full_name: tap_full_name,
|
||||
pr_message: "Created with `brew bump-cask-pr`.",
|
||||
}
|
||||
GitHub.create_bump_pr(pr_info, args: args)
|
||||
@ -199,8 +195,8 @@ module Homebrew
|
||||
resource.fetch
|
||||
end
|
||||
|
||||
def check_open_pull_requests(cask, tap_full_name, args:)
|
||||
GitHub.check_for_duplicate_pull_requests(cask.token, tap_full_name,
|
||||
def check_open_pull_requests(cask, args:)
|
||||
GitHub.check_for_duplicate_pull_requests(cask.token, cask.tap.full_name,
|
||||
state: "open",
|
||||
file: cask.sourcefile_path.relative_path_from(cask.tap.path).to_s,
|
||||
args: args)
|
||||
|
||||
@ -84,9 +84,9 @@ module Homebrew
|
||||
end
|
||||
|
||||
def use_correct_linux_tap(formula, args:)
|
||||
default_origin_branch = formula.tap.path.git_origin_branch if formula.tap
|
||||
default_origin_branch = formula.tap.path.git_origin_branch
|
||||
|
||||
return formula.tap&.full_name, "origin", default_origin_branch, "-" if !OS.linux? || !formula.tap.core_tap?
|
||||
return formula.tap.full_name, "origin", default_origin_branch, "-" if !OS.linux? || !formula.tap.core_tap?
|
||||
|
||||
tap_full_name = formula.tap.full_name.gsub("linuxbrew", "homebrew")
|
||||
homebrew_core_url = "https://github.com/#{tap_full_name}"
|
||||
@ -139,6 +139,8 @@ module Homebrew
|
||||
raise FormulaUnspecifiedError if formula.blank?
|
||||
|
||||
odie "This formula is disabled!" if formula.disabled?
|
||||
odie "This formula is not in a tap!" if formula.tap.blank?
|
||||
odie "This formula's tap is not a Git repository!" unless formula.tap.git?
|
||||
|
||||
tap_full_name, remote, remote_branch, previous_branch = use_correct_linux_tap(formula, args: args)
|
||||
check_open_pull_requests(formula, tap_full_name, args: args)
|
||||
|
||||
@ -671,16 +671,16 @@ module GitHub
|
||||
end
|
||||
|
||||
def create_bump_pr(info, args:)
|
||||
tap = info[:tap]
|
||||
sourcefile_path = info[:sourcefile_path]
|
||||
old_contents = info[:old_contents]
|
||||
additional_files = info[:additional_files] || []
|
||||
remote = info[:remote] || "origin"
|
||||
remote_branch = info[:remote_branch]
|
||||
remote_branch = info[:remote_branch] || tap.path.git_origin_branch
|
||||
branch = info[:branch_name]
|
||||
commit_message = info[:commit_message]
|
||||
previous_branch = info[:previous_branch]
|
||||
tap = info[:tap]
|
||||
tap_full_name = info[:tap_full_name]
|
||||
previous_branch = info[:previous_branch] || "-"
|
||||
tap_full_name = info[:tap_full_name] || tap.full_name
|
||||
pr_message = info[:pr_message]
|
||||
|
||||
sourcefile_path.parent.cd do
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user