Merge pull request #16633 from sohanh/improved-github-link-for-permission-error-message
Improved the GitHub link that is generated when the required scope of the token has mismatched with the present scope
This commit is contained in:
commit
8b69b898ec
@ -200,6 +200,7 @@ module GitHub
|
|||||||
credentials_scopes = response_headers["x-oauth-scopes"]
|
credentials_scopes = response_headers["x-oauth-scopes"]
|
||||||
return if needed_scopes.subset?(Set.new(credentials_scopes.to_s.split(", ")))
|
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"
|
needed_scopes = needed_scopes.to_a.join(", ").presence || "none"
|
||||||
credentials_scopes = "none" if credentials_scopes.blank?
|
credentials_scopes = "none" if credentials_scopes.blank?
|
||||||
|
|
||||||
@ -208,7 +209,7 @@ module GitHub
|
|||||||
Your #{what} credentials do not have sufficient scope!
|
Your #{what} credentials do not have sufficient scope!
|
||||||
Scopes required: #{needed_scopes}
|
Scopes required: #{needed_scopes}
|
||||||
Scopes present: #{credentials_scopes}
|
Scopes present: #{credentials_scopes}
|
||||||
#{GitHub.pat_blurb}
|
#{github_permission_link}
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user