Merge pull request #7308 from Bo98/pr-publish

dev-cmd/pr-publish: fix undefined method error on invalid input
This commit is contained in:
Dawid Dziurla 2020-04-09 07:12:05 +02:00 committed by GitHub
commit 2a424ff982
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -29,8 +29,8 @@ module Homebrew
arg = "#{CoreTap.instance.default_remote}/pull/#{arg}" if arg.to_i.positive? arg = "#{CoreTap.instance.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
tap = Tap.fetch(user, repo) if repo.match?(HOMEBREW_OFFICIAL_REPO_PREFIXES_REGEX)
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