Open JackColeman opened 2 months ago
Thanks for the suggestion @JackColeman - it makes sense. With the GitHub App approach, it would be possible to fetch Copilot usage metrics for organization and Teams but not for Enterprise members. cc: @djopatrny , for awareness
I am adding this one as an enhancement!
I've done some experimentation and as per the nature of the app being frontend only it poses a complication to retrieve a pem file so it can authenticate as a GitHub app and generate an IAT. I am exploring if it makes sense to add a light backend for it.
I've done a sample implementation here https://github.com/karpikpl/copilot-metrics-viewer it uses a github app user tokens and all the calls to GH are proxied via backend express API
In the .env file, there is an option to connect with a GitHub Personal Access Token:
VUE_APP_GITHUB_TOKEN=
In large organizations, there are policies against over granting privileges to tokens for sensitive things like copilot billing and usage. Following the principle of least privilege, we are required to access sensitive data via a GitHub app.
Support for connecting through a GitHub app would allow us to use this project as is. For example:
A workaround is to extract the data from the GitHub Copilot Usage endpoint, and store it in a file called
src/resources/metricsExample.json
and setVUE_APP_MOCKED_DATA=true
. This would require additional automation, and the preferred way would be to pull real time data from the API with a GitHub App.