This action exports usage metrics from the GitHub Copilot Metrics API into a CSV file. The files are available as workflow artifacts in the GitHub Action run.
| Input | Description | Required | Default |
|---|---|---|---|
access-token |
The access token to use for authenticating with the GitHub API. See the eligible access token types and required permissions in the GitHub Copilot Metrics API documentation. | Yes | - |
enterprise-summary |
true or false on whether to generate a csv for Copilot usage for enterprise members. |
No | false |
enterprise-name |
The name/slug of the enterprise to generate a csv for. Example: myent for https://github.com/enterprises/myent. |
If enterprise-summary is true |
- |
enterprise-team-summary |
true or false on whether to generate a csv for Copilot usage for an enterprise team. |
No | false |
enterprise-team-name |
The slug of the enterprise team to generate a csv for. Example: engineering for https://github.com/orgs/myorg/teams/engineering. Use 'all' or '*' to generate a report containing every team |
If enterprise-team-summary is true |
- |
org-summary |
true or false on whether to generate a csv for Copilot usage for organization members. |
No | false |
org-name |
The name of the organization to generate a csv for. Example: myorg for https://github.com/myorg. |
No | Name of organization that action is running in. |
team-summary |
true or false on whether to generate a csv for Copilot usage for a team. |
No | false |
team-name |
The name of the team to generate a csv for. Example: engineering for https://github.com/orgs/myorg/teams/engineering. |
If team-summary is true |
- |
In order to run this action you must create a GitHub Action workflow (.github/workflows/copilot-api-export.yml). See Creating a Workflow file.
Generate a CSV for Copilot usage for organization members:
name: Copilot Metrics Export
on:
workflow_dispatch:
jobs:
run:
name: Copilot Metrics Export Action
runs-on: ubuntu-latest
steps:
- uses: bthomas2622/copilot-metrics-export-action@v1.4
with:
access-token: ${{ secrets.authorized-pat-here}}
org-summary: true
org-name: myorgGenerate a CSV for Copilot metrics for an organzation and its team:
uses: bthomas2622/copilot-metrics-export-action@v1.4
with:
access-token: ${{ secrets.authorized-pat-here}}
enterprise-summary: true
enterprise-name: myenterprise
org-summary: true
org-name: myorg
team-summary: true
team-name: engineeringGenerate a CSV for Copilot metrics for an enterprise and its enterprise team:
uses: bthomas2622/copilot-metrics-export-action@v1.5
with:
access-token: ${{ secrets.authorized-pat-here}}
enterprise-summary: true
enterprise-name: myenterprise
enterprise-team-summary: true
enterprise-team-name: engineeringGenerate a CSV for Copilot metrics for an enterprise and all enterprise teams:
uses: bthomas2622/copilot-metrics-export-action@v1.5
with:
access-token: ${{ secrets.authorized-pat-here}}
enterprise-summary: true
enterprise-name: myenterprise
enterprise-team-summary: true
enterprise-team-name: '*'See the eligible access token types and required permissions in the GitHub Copilot Metrics API documentation.
If you choose to utilize a Personal Access Token (PAT) (Classic) it must possess copilot, manage_billing:copilot, admin:org, admin:enterprise, or manage_billing:enterprise scope to use the Copilot Metrics API endpoint.
Add this PAT as a secret so it can be used as input for access-token, see Creating encrypted secrets for a repository.
If your organization has SAML enabled you must authorize the PAT, see Authorizing a personal access token for use with SAML single sign-on.
The files are available as workflow artifacts in the GitHub Action run.
