Skip to content

Commit

Permalink
github/api: update personal access token format.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonchang committed Mar 14, 2021
1 parent e3b451c commit cd280ee
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Library/Homebrew/utils/github/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ module GitHub
#{ALL_SCOPES_URL}
#{Utils::Shell.set_variable_in_profile("HOMEBREW_GITHUB_API_TOKEN", "your_token_here")}
EOS
GITHUB_PAT_REGEX = /^(?:[a-f0-9]{40}|gp1_[A-Za-z0-9_]{40,255})$/.freeze

# Helper functions to access the GitHub API.
#
Expand Down Expand Up @@ -127,7 +128,7 @@ def keychain_username_password
# Don't use passwords from the keychain unless they look like
# GitHub Personal Access Tokens:
# https://github.com/Homebrew/brew/issues/6862#issuecomment-572610344
return unless /^[a-f0-9]{40}$/i.match?(github_password)
return unless GITHUB_PAT_REGEX.match?(github_password)

github_password
rescue Errno::EPIPE
Expand Down

0 comments on commit cd280ee

Please sign in to comment.