From a0bf5c9ead85a6362f23524ce900ab5415410f36 Mon Sep 17 00:00:00 2001 From: Dawid Dziurla Date: Mon, 27 Jul 2020 12:29:08 +0200 Subject: [PATCH] pr-publish: check if url repo equals provided tap arg Co-authored-by: Jonathan Chang --- Library/Homebrew/dev-cmd/pr-publish.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Library/Homebrew/dev-cmd/pr-publish.rb b/Library/Homebrew/dev-cmd/pr-publish.rb index 899e2dee64..54b4a28c2e 100644 --- a/Library/Homebrew/dev-cmd/pr-publish.rb +++ b/Library/Homebrew/dev-cmd/pr-publish.rb @@ -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