octokit/octokit.rb

[FEAT]: Read `x-oauth-scopes` returned from the API

yeikel opened this issue · 2 comments

Describe the need

I would like to read x-oauth-scopes returned from the API headers to make decisions

I could not find any native method to do this with octokit but I could be wrong

I am currently implementing it with the following snippet :

response = HTTParty.get(
  "https://#{ENV['GITHUB_ENTERPRISE_HOSTNAME']}/api/v3/user",
  :headers => {
    "Authorization" => "Bearer #{ENV["GITHUB_ENTERPRISE_ACCESS_TOKEN"]}"
  })

scopes = response.headers['x-oauth-scopes']

SDK Version

No response

API Version

No response

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Hey, @yeikel, thanks for highlighting this. It seems like it would be a nice addition. Is this something you'd be up for giving a shot at making a PR for? I'll add the "up for grabs" label on this and put it in the backlog so we can prioritize it. Thanks again for the idea/suggestion. ❤