github-copilot-resources/copilot-metrics-viewer

Only Organization Owner can view Copilot Metrics

Opened this issue · 2 comments

Hi,

We're hosting the Copilot metrics viewer on AWS / ECS and we're using the recommended proxy setup using GitHub app.
The app has one Readonly Setting:

GitHub Copilot Business 
Manage Copilot Business seats and settings

Now it seems that only Organization Owners can view the metrics.

A member of the organization is able to login but then he gets:

undefined
If .env file is modified ...

In the dev tools we see:

{
  "message": "Resource not accessible by integration",
  "documentation_url": "https://docs.github.com/rest/copilot/copilot-usage#get-a-summary-of-copilot-usage-for-organization-members",
  "status": "403"
}

Is this expected? We want to give insights to more people than just organizational owners.

I am not an expert for copilot app. and I just found below statement when builidng a copilot extension, since copilot extension is a kind of copilot App, I assume it follows the same permissions rule ?

Requests to your Copilot agent will receive an X-Github-Token header. This header contains an API token that can be used to fetch resources from the GitHub API on behalf of the user interacting with your agent. **The permissions of this token are the overlap of the user's own permissions and the permissions granted to your GitHub App installation.**

https://docs.github.com/en/copilot/building-copilot-extensions/building-a-copilot-agent-for-your-copilot-extension/configuring-your-copilot-agent-to-communicate-with-github

Thanks for the useful reply. After taking a closer look at the error and the docs, it became clear that the failing call requires the following permissions:

  • "GitHub Copilot Business" organization permissions (read)
  • "Administration" organization permissions (read)

So, I added the "Administration" organization permissions (read) to the application,

Read access to organization administration and organization copilot seat management

but unfortunately, the same error persists.