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=", flag "--with-label=",
description: "Pull requests must have this label." description: "Pull requests must have this label."
comma_array "--without-labels=", 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", switch "--without-approval",
description: "Pull requests do not require approval to be merged." description: "Pull requests do not require approval to be merged."
switch "--publish", switch "--publish",
description: "Run `brew pr-publish` on matching pull requests." 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", switch "--ignore-failures",
description: "Include pull requests that have failing status checks." description: "Include pull requests that have failing status checks."
@ -34,7 +38,7 @@ module Homebrew
def pr_automerge def pr_automerge
args = pr_automerge_args.parse 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) tap = Tap.fetch(args.tap || CoreTap.instance.name)
query = "is:pr is:open repo:#{tap.full_name}" query = "is:pr is:open repo:#{tap.full_name}"
@ -57,12 +61,13 @@ module Homebrew
pr_urls << pr["html_url"] pr_urls << pr["html_url"]
end end
publish_args = ["pr-publish"]
publish_args << "--tap=#{tap}" if tap
publish_args << "--autosquash" if args.autosquash?
if args.publish? if args.publish?
publish_args = ["pr-publish"]
publish_args << "--tap=#{tap}" if tap
safe_system HOMEBREW_BREW_FILE, *publish_args, *pr_urls safe_system HOMEBREW_BREW_FILE, *publish_args, *pr_urls
else 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 end
end end

View File

@ -1081,11 +1081,13 @@ Find pull requests that can be automatically merged using `brew pr-publish`.
* `--with-label`: * `--with-label`:
Pull requests must have this label. Pull requests must have this label.
* `--without-labels`: * `--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`: * `--without-approval`:
Pull requests do not require approval to be merged. Pull requests do not require approval to be merged.
* `--publish`: * `--publish`:
Run `brew pr-publish` on matching pull requests. 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`: * `--ignore-failures`:
Include pull requests that have failing status checks. Include pull requests that have failing status checks.

View File

@ -1501,7 +1501,7 @@ Pull requests must have this label\.
. .
.TP .TP
\fB\-\-without\-labels\fR \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 .TP
\fB\-\-without\-approval\fR \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\. Run \fBbrew pr\-publish\fR on matching pull requests\.
. .
.TP .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 \fB\-\-ignore\-failures\fR
Include pull requests that have failing status checks\. Include pull requests that have failing status checks\.
. .