dev-cmd/pr-*: allow to run on other taps too

This commit is contained in:
Dawid Dziurla 2020-07-02 22:47:45 +02:00
parent 6d27367c7e
commit 77a1bc22d7
No known key found for this signature in database
GPG Key ID: 7B6D8368172E9B0B
4 changed files with 15 additions and 8 deletions

View File

@ -34,7 +34,6 @@ module Homebrew
def pr_automerge def pr_automerge
pr_automerge_args.parse pr_automerge_args.parse
ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"] = "1" unless OS.mac?
without_labels = Homebrew.args.without_labels || ["do not merge", "new formula"] without_labels = Homebrew.args.without_labels || ["do not merge", "new formula"]
tap = Tap.fetch(Homebrew.args.tap || CoreTap.instance.name) tap = Tap.fetch(Homebrew.args.tap || CoreTap.instance.name)
@ -59,7 +58,7 @@ module Homebrew
end end
if args.publish? if args.publish?
safe_system "#{HOMEBREW_PREFIX}/bin/brew", "pr-publish", *pr_urls safe_system HOMEBREW_BREW_FILE, "pr-publish", *pr_urls
else else
ohai "Now run:", " brew pr-publish \\\n #{pr_urls.join " \\\n "}" ohai "Now run:", " brew pr-publish \\\n #{pr_urls.join " \\\n "}"
end end

View File

@ -12,8 +12,10 @@ module Homebrew
`pr-publish` [<options>] <pull_request> [<pull_request> ...] `pr-publish` [<options>] <pull_request> [<pull_request> ...]
Publish bottles for a pull request with GitHub Actions. Publish bottles for a pull request with GitHub Actions.
Requires write access to the `homebrew/core` repository. Requires write access to the repository.
EOS EOS
flag "--tap=",
description: "Target tap repository (default: `homebrew/core`)."
switch :verbose switch :verbose
min_named 1 min_named 1
end end
@ -22,14 +24,13 @@ module Homebrew
def pr_publish def pr_publish
pr_publish_args.parse pr_publish_args.parse
ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"] = "1" unless OS.mac? tap = Tap.fetch(Homebrew.args.tap || CoreTap.instance.name)
args.named.uniq.each do |arg| args.named.uniq.each do |arg|
arg = "#{CoreTap.instance.default_remote}/pull/#{arg}" if arg.to_i.positive? arg = "#{tap.default_remote}/pull/#{arg}" if arg.to_i.positive?
url_match = arg.match HOMEBREW_PULL_OR_COMMIT_URL_REGEX url_match = arg.match HOMEBREW_PULL_OR_COMMIT_URL_REGEX
_, user, repo, issue = *url_match _, user, repo, issue = *url_match
odie "Not a GitHub pull request: #{arg}" unless issue odie "Not a GitHub pull request: #{arg}" unless issue
tap = Tap.fetch(user, repo) if repo.match?(HOMEBREW_OFFICIAL_REPO_PREFIXES_REGEX)
ohai "Dispatching #{tap} pull request ##{issue}" ohai "Dispatching #{tap} pull request ##{issue}"
GitHub.dispatch_event(user, repo, "Publish ##{issue}", pull_request: issue) GitHub.dispatch_event(user, repo, "Publish ##{issue}", pull_request: issue)
end end

View File

@ -883,7 +883,10 @@ Find pull requests that can be automatically merged using `brew pr-publish`.
### `pr-publish` [*`options`*] *`pull_request`* [*`pull_request`* ...] ### `pr-publish` [*`options`*] *`pull_request`* [*`pull_request`* ...]
Publish bottles for a pull request with GitHub Actions. Requires write access to Publish bottles for a pull request with GitHub Actions. Requires write access to
the `homebrew/core` repository. the repository.
* `--tap`:
Target tap repository (default: `homebrew/core`).
### `pr-pull` [*`options`*] *`pull_request`* [*`pull_request`* ...] ### `pr-pull` [*`options`*] *`pull_request`* [*`pull_request`* ...]

View File

@ -1146,7 +1146,11 @@ Run \fBbrew pr\-publish\fR on matching pull requests\.
Include pull requests that have failing status checks\. Include pull requests that have failing status checks\.
. .
.SS "\fBpr\-publish\fR [\fIoptions\fR] \fIpull_request\fR [\fIpull_request\fR \.\.\.]" .SS "\fBpr\-publish\fR [\fIoptions\fR] \fIpull_request\fR [\fIpull_request\fR \.\.\.]"
Publish bottles for a pull request with GitHub Actions\. Requires write access to the \fBhomebrew/core\fR repository\. Publish bottles for a pull request with GitHub Actions\. Requires write access to the repository\.
.
.TP
\fB\-\-tap\fR
Target tap repository (default: \fBhomebrew/core\fR)\.
. .
.SS "\fBpr\-pull\fR [\fIoptions\fR] \fIpull_request\fR [\fIpull_request\fR \.\.\.]" .SS "\fBpr\-pull\fR [\fIoptions\fR] \fIpull_request\fR [\fIpull_request\fR \.\.\.]"
Download and publish bottles, and apply the bottle commit from a pull request with artifacts generated by GitHub Actions\. Requires write access to the repository\. Download and publish bottles, and apply the bottle commit from a pull request with artifacts generated by GitHub Actions\. Requires write access to the repository\.