pull: allow pulling from API URLs.
Jenkins has started spitting these out; no idea why.
This commit is contained in:
parent
2d1c8b4de4
commit
3f9d5aad74
@ -6,6 +6,8 @@ require 'formula'
|
|||||||
require 'cmd/tap'
|
require 'cmd/tap'
|
||||||
|
|
||||||
module Homebrew
|
module Homebrew
|
||||||
|
HOMEBREW_PULL_API_REGEX = %r{https://api\.github\.com/repos/([\w-]+)/homebrew(-[\w-]+)?/pulls/(\d+)}
|
||||||
|
|
||||||
def tap arg
|
def tap arg
|
||||||
match = arg.match(%r[homebrew-([\w-]+)/])
|
match = arg.match(%r[homebrew-([\w-]+)/])
|
||||||
match[1].downcase if match
|
match[1].downcase if match
|
||||||
@ -60,6 +62,11 @@ module Homebrew
|
|||||||
url = 'https://github.com/Homebrew/homebrew/pull/' + arg
|
url = 'https://github.com/Homebrew/homebrew/pull/' + arg
|
||||||
issue = arg
|
issue = arg
|
||||||
else
|
else
|
||||||
|
if (api_match = arg.match HOMEBREW_PULL_API_REGEX)
|
||||||
|
_, user, tap, pull = *api_match
|
||||||
|
arg = "https://github.com/#{user}/homebrew#{tap}/pull/#{pull}"
|
||||||
|
end
|
||||||
|
|
||||||
url_match = arg.match HOMEBREW_PULL_OR_COMMIT_URL_REGEX
|
url_match = arg.match HOMEBREW_PULL_OR_COMMIT_URL_REGEX
|
||||||
unless url_match
|
unless url_match
|
||||||
ohai 'Ignoring URL:', "Not a GitHub pull request or commit: #{arg}"
|
ohai 'Ignoring URL:', "Not a GitHub pull request or commit: #{arg}"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user