diff --git a/Library/Homebrew/utils/github/api.rb b/Library/Homebrew/utils/github/api.rb index b92d53d715..20a2306f3a 100644 --- a/Library/Homebrew/utils/github/api.rb +++ b/Library/Homebrew/utils/github/api.rb @@ -21,7 +21,7 @@ module GitHub #{ALL_SCOPES_URL} #{Utils::Shell.set_variable_in_profile("HOMEBREW_GITHUB_API_TOKEN", "your_token_here")} 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. # @@ -48,10 +48,10 @@ module GitHub class RateLimitExceededError < Error def initialize(reset, github_message) @github_message = github_message + new_pat_message = ", or:\n#{CREATE_GITHUB_PAT_MESSAGE}" if API.credentials.blank? super <<~EOS GitHub API Error: #{github_message} - Try again in #{pretty_ratelimit_reset(reset)}, or: - #{CREATE_GITHUB_PAT_MESSAGE} + Try again in #{pretty_ratelimit_reset(reset)}#{new_pat_message} EOS end