pr-publish: check if url repo equals provided tap arg

Co-authored-by: Jonathan Chang <jchang641@gmail.com>
This commit is contained in:
Dawid Dziurla 2020-07-27 12:29:08 +02:00
parent 62ca046390
commit a0bf5c9ead
No known key found for this signature in database
GPG Key ID: 7B6D8368172E9B0B

View File

@ -31,6 +31,10 @@ module Homebrew
url_match = arg.match HOMEBREW_PULL_OR_COMMIT_URL_REGEX
_, user, repo, issue = *url_match
odie "Not a GitHub pull request: #{arg}" unless issue
if args.tap.present? && !"#{user}/#{repo}".casecmp(tap.full_name).zero?
odie "Pull request URL is for #{user}/#{repo} but --tap=#{tap.full_name}!"
end
ohai "Dispatching #{tap} pull request ##{issue}"
GitHub.dispatch_event(user, repo, "Publish ##{issue}", pull_request: issue)
end