Skip to content

Commit

Permalink
Merge pull request #16633 from sohanh/improved-github-link-for-permis…
Browse files Browse the repository at this point in the history
…sion-error-message

Improved the GitHub link that is generated when the required scope of the token has mismatched with the present scope
  • Loading branch information
reitermarkus authored Feb 10, 2024
2 parents 73f9869 + 94afce5 commit 8b69b89
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 @@ -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

0 comments on commit 8b69b89

Please sign in to comment.