Merge pull request #11739 from Logicer16/dont-ask-for-a-PAT-if-one-already-exists
GitHub/API: Don't ask for a PAT if one already exists
This commit is contained in:
commit
41d62e9084
@ -21,7 +21,7 @@ module GitHub
|
|||||||
#{ALL_SCOPES_URL}
|
#{ALL_SCOPES_URL}
|
||||||
#{Utils::Shell.set_variable_in_profile("HOMEBREW_GITHUB_API_TOKEN", "your_token_here")}
|
#{Utils::Shell.set_variable_in_profile("HOMEBREW_GITHUB_API_TOKEN", "your_token_here")}
|
||||||
EOS
|
EOS
|
||||||
GITHUB_PERSONAL_ACCESS_TOKEN_REGEX = /^(?:[a-f0-9]{40}|ghp_\w{36,251})$/.freeze
|
GITHUB_PERSONAL_ACCESS_TOKEN_REGEX = /^(?:[a-f0-9]{40}|gh[po]_\w{36,251})$/.freeze
|
||||||
|
|
||||||
# Helper functions to access the GitHub API.
|
# Helper functions to access the GitHub API.
|
||||||
#
|
#
|
||||||
@ -48,10 +48,10 @@ module GitHub
|
|||||||
class RateLimitExceededError < Error
|
class RateLimitExceededError < Error
|
||||||
def initialize(reset, github_message)
|
def initialize(reset, github_message)
|
||||||
@github_message = github_message
|
@github_message = github_message
|
||||||
|
new_pat_message = ", or:\n#{CREATE_GITHUB_PAT_MESSAGE}" if API.credentials.blank?
|
||||||
super <<~EOS
|
super <<~EOS
|
||||||
GitHub API Error: #{github_message}
|
GitHub API Error: #{github_message}
|
||||||
Try again in #{pretty_ratelimit_reset(reset)}, or:
|
Try again in #{pretty_ratelimit_reset(reset)}#{new_pat_message}
|
||||||
#{CREATE_GITHUB_PAT_MESSAGE}
|
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user