Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved the GitHub link that is generated when the required scope of the token has mismatched with the present scope #16633

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Library/Homebrew/utils/github/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ def self.credentials_error_message(response_headers, needed_scopes)
credentials_scopes = response_headers["x-oauth-scopes"]
return if needed_scopes.subset?(Set.new(credentials_scopes.to_s.split(", ")))

github_permission_link = GitHub.pat_blurb(needed_scopes.to_a)
needed_scopes = needed_scopes.to_a.join(", ").presence || "none"
credentials_scopes = "none" if credentials_scopes.blank?

Expand All @@ -208,7 +209,7 @@ def self.credentials_error_message(response_headers, needed_scopes)
Your #{what} credentials do not have sufficient scope!
Scopes required: #{needed_scopes}
Scopes present: #{credentials_scopes}
#{GitHub.pat_blurb}
#{github_permission_link}
EOS
end

Expand Down
Loading