get_repo_license: ignore ip allowlist error
This commit is contained in:
parent
b69bd66fc4
commit
45378f35e2
@ -504,6 +504,8 @@ module GitHub
|
|||||||
response["license"]["spdx_id"]
|
response["license"]["spdx_id"]
|
||||||
rescue API::HTTPNotFoundError
|
rescue API::HTTPNotFoundError
|
||||||
nil
|
nil
|
||||||
|
rescue API::AuthenticationFailedError => e
|
||||||
|
raise unless e.message.match?(API::GITHUB_IP_ALLOWLIST_ERROR)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.pull_request_title_regex(name, version = nil)
|
def self.pull_request_title_regex(name, version = nil)
|
||||||
|
|||||||
@ -60,6 +60,10 @@ module GitHub
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
GITHUB_IP_ALLOWLIST_ERROR = Regexp.new("Although you appear to have the correct authorization credentials, " \
|
||||||
|
"the `(.+)` organization has an IP allow list enabled, " \
|
||||||
|
"and your IP address is not permitted to access this resource").freeze
|
||||||
|
|
||||||
NO_CREDENTIALS_MESSAGE = <<~MESSAGE
|
NO_CREDENTIALS_MESSAGE = <<~MESSAGE
|
||||||
No GitHub credentials found in macOS Keychain, GitHub CLI or the environment.
|
No GitHub credentials found in macOS Keychain, GitHub CLI or the environment.
|
||||||
#{GitHub.pat_blurb}
|
#{GitHub.pat_blurb}
|
||||||
|
|||||||
@ -12,10 +12,6 @@ module SharedAudits
|
|||||||
|
|
||||||
URL_TYPE_HOMEPAGE = "homepage URL"
|
URL_TYPE_HOMEPAGE = "homepage URL"
|
||||||
|
|
||||||
GITHUB_IP_ALLOWLIST_ERROR = Regexp.new("Although you appear to have the correct authorization credentials, " \
|
|
||||||
"the `(.+)` organization has an IP allow list enabled, " \
|
|
||||||
"and your IP address is not permitted to access this resource").freeze
|
|
||||||
|
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
def github_repo_data(user, repo)
|
def github_repo_data(user, repo)
|
||||||
@ -26,7 +22,7 @@ module SharedAudits
|
|||||||
rescue GitHub::API::HTTPNotFoundError
|
rescue GitHub::API::HTTPNotFoundError
|
||||||
nil
|
nil
|
||||||
rescue GitHub::API::AuthenticationFailedError => e
|
rescue GitHub::API::AuthenticationFailedError => e
|
||||||
raise unless e.message.match?(GITHUB_IP_ALLOWLIST_ERROR)
|
raise unless e.message.match?(GitHub::API::GITHUB_IP_ALLOWLIST_ERROR)
|
||||||
end
|
end
|
||||||
|
|
||||||
def github_release_data(user, repo, tag)
|
def github_release_data(user, repo, tag)
|
||||||
@ -39,7 +35,7 @@ module SharedAudits
|
|||||||
rescue GitHub::API::HTTPNotFoundError
|
rescue GitHub::API::HTTPNotFoundError
|
||||||
nil
|
nil
|
||||||
rescue GitHub::API::AuthenticationFailedError => e
|
rescue GitHub::API::AuthenticationFailedError => e
|
||||||
raise unless e.message.match?(GITHUB_IP_ALLOWLIST_ERROR)
|
raise unless e.message.match?(GitHub::API::GITHUB_IP_ALLOWLIST_ERROR)
|
||||||
end
|
end
|
||||||
|
|
||||||
def github_release(user, repo, tag, formula: nil, cask: nil)
|
def github_release(user, repo, tag, formula: nil, cask: nil)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user