Class: Homebrew::DevCmd::PrAutomerge Private
- Inherits:
-
AbstractCommand
- Object
- AbstractCommand
- Homebrew::DevCmd::PrAutomerge
- Defined in:
- dev-cmd/pr-automerge.rb,
sorbet/rbi/dsl/homebrew/dev_cmd/pr_automerge.rbi
This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.
Defined Under Namespace
Classes: Args
Instance Method Summary collapse
- #args ⇒ Homebrew::DevCmd::PrAutomerge::Args private
- #run ⇒ void private
Methods inherited from AbstractCommand
command, command_name, dev_cmd?, #initialize, parser, ruby_cmd?
Constructor Details
This class inherits a constructor from Homebrew::AbstractCommand
Instance Method Details
#args ⇒ Homebrew::DevCmd::PrAutomerge::Args
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
10 |
# File 'sorbet/rbi/dsl/homebrew/dev_cmd/pr_automerge.rbi', line 10 def args; end |
#run ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
This method returns an undefined value.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'dev-cmd/pr-automerge.rb', line 39 def run without_labels = args.without_labels || [ "do not merge", "new formula", "automerge-skip", "pre-release", "CI-published-bottle-commits", ] tap = Tap.fetch(args.tap || CoreTap.instance.name) query = "is:pr is:open repo:#{tap.full_name} draft:false" query += args.ignore_failures? ? " -status:pending" : " status:success" query += " review:approved" unless args.without_approval? query += " label:\"#{args.with_label}\"" if args.with_label without_labels.each { |label| query += " -label:\"#{label}\"" } odebug "Searching: #{query}" prs = GitHub.search_issues query if prs.blank? ohai "No matching pull requests!" return end ohai "#{prs.count} matching pull #{Utils.pluralize("request", prs.count)}:" pr_urls = [] prs.each do |pr| puts "#{tap.full_name unless tap.core_tap?}##{pr["number"]}: #{pr["title"]}" pr_urls << pr["html_url"] end publish_args = ["pr-publish"] publish_args << "--tap=#{tap}" if tap publish_args << "--workflow=#{args.workflow}" if args.workflow publish_args << "--autosquash" if args.autosquash? if args.publish? safe_system HOMEBREW_BREW_FILE, *publish_args, *pr_urls else ohai "Now run:", " brew #{publish_args.join " "} \\\n #{pr_urls.join " \\\n "}" end end |