Merge pull request #10847 from jonchang/github-pat-update
github/api: update personal access token format.
This commit is contained in:
commit
95a5c58eee
@ -21,6 +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
|
||||||
|
|
||||||
# Helper functions to access the GitHub API.
|
# Helper functions to access the GitHub API.
|
||||||
#
|
#
|
||||||
@ -125,7 +126,7 @@ module GitHub
|
|||||||
# Don't use passwords from the keychain unless they look like
|
# Don't use passwords from the keychain unless they look like
|
||||||
# GitHub Personal Access Tokens:
|
# GitHub Personal Access Tokens:
|
||||||
# https://github.com/Homebrew/brew/issues/6862#issuecomment-572610344
|
# https://github.com/Homebrew/brew/issues/6862#issuecomment-572610344
|
||||||
return unless /^[a-f0-9]{40}$/i.match?(github_password)
|
return unless GITHUB_PERSONAL_ACCESS_TOKEN_REGEX.match?(github_password)
|
||||||
|
|
||||||
github_password
|
github_password
|
||||||
rescue Errno::EPIPE
|
rescue Errno::EPIPE
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user