You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
GitHub Action
Copilot Usage Action
v1.0
Get Copilot usage data as a job summary.
Create a workflow (eg: .github/workflows/copilot-usage.yml
). See Creating a Workflow file.
You will need to create a PAT(Personal Access Token) that has the copilot
, manage_billing:copilot
, admin:org
, admin:enterprise
, or manage_billing:enterprise
scope to use this endpoint.
Add this PAT as a secret so we can use it as input github-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.
name: TypeScript Action Workflow
on:
workflow_dispatch:
jobs:
run:
name: Run Action
runs-on: ubuntu-latest
steps:
- uses: austenstone/copilot-usage@main
with:
enterprise: github
job-summary: true
csv: true
github-token: ${{ secrets.TOKEN }}
Various inputs are defined in action.yml
:
Name | Description | Default |
---|---|---|
github-token | The GitHub token used to create an authenticated client | ${{ github.token }} |
enterprise | The GitHub enterprise slug | |
organization | The organization slug | ${{ github.repository_owner }} |
team | The team slug | |
days | The number of days to show usage metrics for | |
since | Show usage metrics since this date. This is a timestamp in ISO 8601 format (YYYY-MM-DDTHH:MM:SSZ). Maximum value is 28 days ago | |
until | Show usage metrics until this date. This is a timestamp in ISO 8601 format (YYYY-MM-DDTHH:MM:SSZ). Maximum value is 28 days ago | |
job-summary | Whether to generate a report | true |
csv | Whether to generate a CSV as a workflow artifact | false |
Name | Description |
---|---|
result | The copilot usage as a JSON string |
To get more help on the Actions see documentation.