pr-automerge: enable --autosquash argument

This commit is contained in:
Jonathan Chang 2020-10-13 21:34:11 +11:00
parent 8d2ad515ea
commit 1b45ed1045
3 changed files with 18 additions and 7 deletions

View File

@ -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
if args.publish?
publish_args = ["pr-publish"]
publish_args << "--tap=#{tap}" if tap
publish_args << "--autosquash" if args.autosquash?
if args.publish?
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

View File

@ -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.

View File

@ -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\.
.