diff --git a/Library/Homebrew/dev-cmd/pr-automerge.rb b/Library/Homebrew/dev-cmd/pr-automerge.rb index 40c4007f89..16634dd450 100644 --- a/Library/Homebrew/dev-cmd/pr-automerge.rb +++ b/Library/Homebrew/dev-cmd/pr-automerge.rb @@ -19,11 +19,15 @@ module Homebrew flag "--with-label=", description: "Pull requests must have this label." comma_array "--without-labels=", - description: "Pull requests must not have these labels (default: `do not merge`, `new formula`)." + description: "Pull requests must not have these labels "\ + "(default: `do not merge`, `new formula`, `automerge-skip`)." switch "--without-approval", description: "Pull requests do not require approval to be merged." switch "--publish", description: "Run `brew pr-publish` on matching pull requests." + switch "--autosquash", + description: "Instruct `brew pr-publish` to automatically reformat and reword commits "\ + "in the pull request to our preferred format." switch "--ignore-failures", description: "Include pull requests that have failing status checks." @@ -34,7 +38,7 @@ module Homebrew def pr_automerge args = pr_automerge_args.parse - without_labels = args.without_labels || ["do not merge", "new formula"] + without_labels = args.without_labels || ["do not merge", "new formula", "automerge-skip"] tap = Tap.fetch(args.tap || CoreTap.instance.name) query = "is:pr is:open repo:#{tap.full_name}" @@ -57,12 +61,13 @@ module Homebrew pr_urls << pr["html_url"] end + publish_args = ["pr-publish"] + publish_args << "--tap=#{tap}" if tap + publish_args << "--autosquash" if args.autosquash? if args.publish? - publish_args = ["pr-publish"] - publish_args << "--tap=#{tap}" if tap safe_system HOMEBREW_BREW_FILE, *publish_args, *pr_urls else - ohai "Now run:", " brew pr-publish \\\n #{pr_urls.join " \\\n "}" + ohai "Now run:", " brew #{publish_args.join " "} \\\n #{pr_urls.join " \\\n "}" end end end diff --git a/docs/Manpage.md b/docs/Manpage.md index 3bd3c032d9..3d2d523253 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -1081,11 +1081,13 @@ Find pull requests that can be automatically merged using `brew pr-publish`. * `--with-label`: Pull requests must have this label. * `--without-labels`: - Pull requests must not have these labels (default: `do not merge`, `new formula`). + Pull requests must not have these labels (default: `do not merge`, `new formula`, `automerge-skip`). * `--without-approval`: Pull requests do not require approval to be merged. * `--publish`: Run `brew pr-publish` on matching pull requests. +* `--autosquash`: + Instruct `brew pr-publish` to automatically reformat and reword commits in the pull request to our preferred format. * `--ignore-failures`: Include pull requests that have failing status checks. diff --git a/manpages/brew.1 b/manpages/brew.1 index 24b3607aab..6d57c7068e 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -1501,7 +1501,7 @@ Pull requests must have this label\. . .TP \fB\-\-without\-labels\fR -Pull requests must not have these labels (default: \fBdo not merge\fR, \fBnew formula\fR)\. +Pull requests must not have these labels (default: \fBdo not merge\fR, \fBnew formula\fR, \fBautomerge\-skip\fR)\. . .TP \fB\-\-without\-approval\fR @@ -1512,6 +1512,10 @@ Pull requests do not require approval to be merged\. Run \fBbrew pr\-publish\fR on matching pull requests\. . .TP +\fB\-\-autosquash\fR +Instruct \fBbrew pr\-publish\fR to automatically reformat and reword commits in the pull request to our preferred format\. +. +.TP \fB\-\-ignore\-failures\fR Include pull requests that have failing status checks\. .