GitHub Action
Copilot Usage Action
Get Copilot usage data as:
- Md Job Summary
- CSV
- XML
- JSON
Powered by the REST API endpoints for GitHub Copilot usage metrics.
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.
The default behavior is to get the usage for the repository owner which is likely the organization.
Important
You need to set the secret TOKEN
in your repository settings.
name: Copilot Usage
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
run:
name: Run Action
runs-on: ubuntu-latest
steps:
- uses: austenstone/[email protected]
with:
github-token: ${{ secrets.TOKEN }}
- uses: austenstone/[email protected]
with:
github-token: ${{ secrets.TOKEN }}
organization: 'org-slug'
team: 'team-slug'
- uses: austenstone/[email protected]
with:
github-token: ${{ secrets.TOKEN }}
enterprise: 'enterprise-slug'
Important
You must set secrets for EMAIL
and PASSWORD
to send the email. You must use an App Password for Gmail.
name: Email Copilot Report
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: austenstone/[email protected]
with:
github-token: ${{ secrets.TOKEN }}
- uses: austenstone/[email protected]
id: pdf
with:
name: copilot-usage
- uses: dawidd6/[email protected]
with:
server_address: smtp.gmail.com
server_port: 465
username: ${{ secrets.EMAIL }}
password: ${{ secrets.PASSWORD }}
from: ${{ secrets.EMAIL }}
to: ${{ secrets.EMAIL }} # Recipient email
subject: "Copilot Usage Report (${{ steps.usage.outputs.since }} - ${{ steps.usage.outputs.until }})"
html_body: |
<!DOCTYPE html>
<html>
<body>
<h1>Copilot Usage Report</h1>
<p>Attached is the Copilot Usage Report for ${{ steps.usage.outputs.since }} - ${{ steps.usage.outputs.until }}!</p>
<p>
<a href="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}#:~:text=Copilot%20Usage%20summary">View the full report on
GitHub.com</a>
</p>
${{ steps.pdf.outputs.job-summary-html }}
</body>
</html>
attachments: ${{ steps.pdf.outputs.pdf-file }}
We look first for enterprise
input, then team
, and finally organization
. If none are provided, we default to the repository owner which is likely the organization.
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 YYYY-MM-DD format. Maximum value is 28 days ago |
|
until | Show usage metrics until this date. This is a timestamp, in YYYY-MM-DD format. 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 |
csv-options | The options for the CSV report | |
xml | Whether to generate an XML as a workflow artifact | false |
xml-options | The options for the XML report |
Name | Description |
---|---|
result | The copilot usage as a JSON string |
since | The date since which the usage metrics are shown |
until | The date until which the usage metrics are shown |
---
config:
xyChart:
width: 1125
height: 500
xAxis:
labelPadding: 20
themeVariables:
xyChart:
backgroundColor: "transparent"
---
xychart-beta
title "Accepts & Acceptance Rate"
x-axis ["03/30", "03/31", "04/01", "04/02", "04/03", "04/04", "04/06", "04/07", "04/08", "04/09", "04/10", "04/11", "04/12", "04/13", "04/14", "04/15", "04/16", "04/17", "04/18", "04/19", "04/20", "04/21", "04/22", "04/23", "04/24"]
y-axis "Acceptances" 0 --> 3204
bar [1523, 1859, 1815, 2237, 2240, 3067, 1476, 1901, 2380, 2391, 2600, 3194, 2137, 672, 1393, 2063, 1945, 1935, 2074, 2137, 627, 1607, 2658, 2735, 2866]
line [814.2319372601368, 851.499070764832, 852.8024637043554, 845.6050023596036, 802.5226434082522, 766.4509788628031, 884.7715622076707, 931.4580211041444, 888.0307441481309, 765.4640287769785, 808.6981846422677, 866.4445008890017, 751.9986820428336, 871.6955465587045, 820.4360294117646, 735.6540901502505, 724.3728931767988, 710.7348389315603, 865.4722584006253, 840.6320441988951, 932.2078886310904, 1273.5166955231264, 861.2694174757282, 855.2547335545579, 888.9316553727009]
---
config:
xyChart:
width: 1125
height: 500
xAxis:
labelPadding: 20
themeVariables:
xyChart:
backgroundColor: "transparent"
---
xychart-beta
title "Daily Active Users"
x-axis ["03/30", "03/31", "04/01", "04/02", "04/03", "04/04", "04/06", "04/07", "04/08", "04/09", "04/10", "04/11", "04/12", "04/13", "04/14", "04/15", "04/16", "04/17", "04/18", "04/19", "04/20", "04/21", "04/22", "04/23", "04/24"]
y-axis "Active Users" 0 --> 139
line [33, 35, 70, 106, 101, 118, 32, 38, 96, 112, 125, 116, 105, 25, 36, 91, 106, 97, 97, 96, 30, 32, 116, 118, 129]
pie showData
title Language Usage
"markdown" : 46441
"typescript" : 27172
"python" : 18868
"typescriptreact" : 17351
"javascript" : 16876
"rust" : 8557
"yaml" : 8030
"ruby" : 7136
"go" : 6162
"java" : 5043
"unknown" : 4318
"text" : 4275
"shell" : 3469
"c#" : 3025
"github-actions-workflow" : 2424
"css" : 2422
"html" : 2266
"json" : 1685
"hcl" : 1298
"vue" : 1022
Language | Suggestions | Acceptances | Acceptance Rate | Lines Suggested | Lines Accepted | Active Users |
---|---|---|---|---|---|---|
typescript | 27172 | 8276 | 30.46% | 45407 | 13864 | 327 |
markdown | 46441 | 7272 | 15.66% | 66610 | 8292 | 377 |
python | 18868 | 6800 | 36.04% | 29912 | 10480 | 354 |
javascript | 16876 | 5618 | 33.29% | 33054 | 11717 | 453 |
typescriptreact | 17351 | 4583 | 26.41% | 28274 | 6721 | 299 |
yaml | 8030 | 2476 | 30.83% | 14990 | 4342 | 287 |
ruby | 7136 | 2140 | 29.99% | 11828 | 2670 | 199 |
java | 5043 | 2045 | 40.55% | 17829 | 6515 | 220 |
rust | 8557 | 1982 | 23.16% | 40011 | 4067 | 73 |
go | 6162 | 1800 | 29.21% | 10694 | 2585 | 109 |
c# | 3025 | 1192 | 39.40% | 7537 | 2726 | 146 |
shell | 3469 | 1021 | 29.43% | 5401 | 1393 | 132 |
github-actions-workflow | 2424 | 793 | 32.71% | 4637 | 1498 | 61 |
html | 2266 | 717 | 31.64% | 8377 | 1553 | 124 |
unknown | 4318 | 628 | 14.54% | 7298 | 831 | 103 |
css | 2422 | 555 | 22.91% | 5062 | 1031 | 97 |
text | 4275 | 388 | 9.08% | 23864 | 533 | 78 |
json | 1685 | 345 | 20.47% | 3446 | 711 | 137 |
hcl | 1298 | 340 | 26.19% | 4501 | 1098 | 55 |
fsharp | 872 | 315 | 36.12% | 2096 | 736 | 36 |
dockerfile | 667 | 244 | 36.58% | 793 | 250 | 49 |
sql | 522 | 216 | 41.38% | 918 | 433 | 69 |
vue | 1022 | 190 | 18.59% | 2375 | 276 | 16 |
emacs-lisp | 564 | 153 | 27.13% | 1143 | 300 | 18 |
powershell | 595 | 138 | 23.19% | 795 | 156 | 31 |
scss | 817 | 128 | 15.67% | 1464 | 144 | 39 |
ql | 807 | 117 | 14.50% | 1720 | 157 | 24 |
kotlin | 177 | 77 | 43.50% | 708 | 356 | 13 |
json with comments | 738 | 70 | 9.49% | 1235 | 80 | 63 |
r | 388 | 70 | 18.04% | 690 | 72 | 16 |
blazor | 311 | 62 | 19.94% | 943 | 115 | 18 |
xml | 151 | 59 | 39.07% | 507 | 245 | 39 |
jade | 151 | 57 | 37.75% | 255 | 104 | 5 |
postcss | 138 | 46 | 33.33% | 296 | 64 | 7 |
lua | 348 | 45 | 12.93% | 1523 | 66 | 7 |
javascriptreact | 64 | 43 | 67.19% | 197 | 73 | 7 |
toml | 267 | 41 | 15.36% | 857 | 54 | 23 |
astro | 125 | 38 | 30.40% | 391 | 122 | 8 |
razor | 95 | 30 | 31.58% | 218 | 37 | 16 |
html+erb | 192 | 28 | 14.58% | 295 | 34 | 19 |
mdx | 250 | 24 | 9.60% | 297 | 24 | 10 |
terraform-vars | 64 | 24 | 37.50% | 79 | 24 | 6 |
html.erb | 107 | 24 | 22.43% | 244 | 51 | 8 |
vs-markdown | 149 | 24 | 16.11% | 149 | 24 | 7 |
ini | 146 | 20 | 13.70% | 190 | 20 | 12 |
dotenv | 106 | 20 | 18.87% | 120 | 17 | 13 |
php | 102 | 18 | 17.65% | 301 | 24 | 17 |
c++ | 70 | 18 | 25.71% | 136 | 34 | 15 |
bicep | 63 | 17 | 26.98% | 120 | 39 | 10 |
postgres | 117 | 17 | 14.53% | 247 | 6 | 14 |
dart | 72 | 17 | 23.61% | 143 | 19 | 7 |
groovy | 71 | 15 | 21.13% | 125 | 20 | 15 |
ignore list | 124 | 15 | 12.10% | 141 | 15 | 24 |
sas | 71 | 14 | 19.72% | 116 | 17 | 2 |
dockercompose | 33 | 10 | 30.30% | 74 | 39 | 9 |
django-txt | 20 | 10 | 50.00% | 24 | 10 | 2 |
puppet | 44 | 9 | 20.45% | 111 | 26 | 7 |
rjsx | 30 | 9 | 30.00% | 107 | 62 | 2 |
git-commit | 288 | 8 | 2.78% | 355 | 8 | 19 |
prisma | 17 | 8 | 47.06% | 33 | 24 | 10 |
tex | 55 | 6 | 10.91% | 73 | 6 | 9 |
kusto | 47 | 6 | 12.77% | 76 | 10 | 7 |
liquid | 106 | 6 | 5.66% | 379 | 16 | 2 |
scminput | 59 | 5 | 8.47% | 152 | 5 | 10 |
graphql | 21 | 5 | 23.81% | 81 | 27 | 3 |
julia | 20 | 4 | 20.00% | 24 | 7 | 3 |
aspnetcorerazor | 8 | 4 | 50.00% | 30 | 12 | 4 |
helm | 18 | 3 | 16.67% | 20 | 3 | 6 |
cobol | 7 | 3 | 42.86% | 8 | 3 | 2 |
makefile | 14 | 3 | 21.43% | 17 | 3 | 7 |
vb | 4 | 3 | 75.00% | 8 | 4 | 4 |
objective-c | 5 | 3 | 60.00% | 31 | 15 | 2 |
pug | 8 | 3 | 37.50% | 9 | 3 | 4 |
scala | 6 | 3 | 50.00% | 23 | 2 | 2 |
gotemplate | 8 | 2 | 25.00% | 16 | 3 | 2 |
vim | 11 | 2 | 18.18% | 27 | 2 | 2 |
perl | 48 | 2 | 4.17% | 60 | 2 | 7 |
nunjucks | 14 | 1 | 7.14% | 16 | 1 | 7 |
properties | 28 | 1 | 3.57% | 43 | 1 | 8 |
mermaid | 6 | 1 | 16.67% | 7 | 1 | 2 |
pip-requirements | 26 | 1 | 3.85% | 28 | 1 | 5 |
nix | 12 | 1 | 8.33% | 28 | 1 | 2 |
rmd | 38 | 1 | 2.63% | 44 | 1 | 2 |
django-html | 3 | 1 | 33.33% | 11 | 9 | 2 |
eruby | 1 | 1 | 100.00% | 4 | 4 | 2 |
postgresql | 6 | 1 | 16.67% | 9 | 1 | 3 |
clojure | 9 | 0 | 0.00% | 11 | 0 | 2 |
objective-cpp | 12 | 0 | 0.00% | 12 | 0 | 2 |
code++.ini | 3 | 0 | 0.00% | 7 | 0 | 1 |
protocol buffer | 1 | 0 | 0.00% | 1 | 0 | 1 |
zsh | 4 | 0 | 0.00% | 18 | 0 | 3 |
ssh_config | 1 | 0 | 0.00% | 1 | 0 | 1 |
swift | 2 | 0 | 0.00% | 3 | 0 | 1 |
gemfile | 7 | 0 | 0.00% | 8 | 0 | 2 |
msbuild | 1 | 0 | 0.00% | 3 | 0 | 1 |
conf | 3 | 0 | 0.00% | 10 | 0 | 1 |
sshconfig | 9 | 0 | 0.00% | 33 | 0 | 3 |
plm | 4 | 0 | 0.00% | 5 | 0 | 1 |
restructuredtext | 1 | 0 | 0.00% | 1 | 0 | 1 |
csv | 2 | 0 | 0.00% | 3 | 0 | 2 |
bat | 2 | 0 | 0.00% | 2 | 0 | 2 |
vgo | 9 | 0 | 0.00% | 14 | 0 | 1 |
hcl.terraform | 1 | 0 | 0.00% | 3 | 0 | 1 |
coffeescript | 5 | 0 | 0.00% | 6 | 0 | 3 |
http request | 1 | 0 | 0.00% | 1 | 0 | 1 |
requirements | 4 | 0 | 0.00% | 4 | 0 | 1 |
emd | 7 | 0 | 0.00% | 7 | 0 | 2 |
c | 2 | 0 | 0.00% | 2 | 0 | 1 |
sqlite | 2 | 0 | 0.00% | 2 | 0 | 1 |
pie showData
title Editor Usage
"vscode" : 178187
"neovim" : 10531
"jetbrains" : 6818
"visual_studio" : 2179
"emacs" : 616
"vim" : 113
Editor | Suggestions | Acceptances | Acceptance Rate | Lines Suggested | Lines Accepted | Active Users |
---|---|---|---|---|---|---|
vscode | 178187 | 46043 | 25.84% | 321088 | 76507 | 3911 |
neovim | 10531 | 2509 | 23.82% | 50495 | 4938 | 133 |
jetbrains | 6818 | 1959 | 28.73% | 14794 | 3583 | 315 |
visual_studio | 2179 | 824 | 37.82% | 4577 | 1673 | 105 |
emacs | 616 | 167 | 27.11% | 1332 | 389 | 24 |
vim | 113 | 29 | 25.66% | 358 | 57 | 19 |
pie showData
title Suggestions by Day of the Week
"Sunday" : 23017
"Monday" : 34279
"Tuesday" : 37333
"Wednesday" : 38297
"Thursday" : 32310
"Friday" : 17250
"Saturday" : 15963
Day | Suggestions | Acceptances | Acceptance Rate | Lines Suggested | Lines Accepted | Active Users | Chat Acceptances | Chat Turns | Active Chat Users |
---|---|---|---|---|---|---|---|---|---|
3/30/2024 | 5993 | 1523 | 25.41% | 15527 | 2709 | 33 | 0 | 0 | 0 |
3/31/2024 | 6995 | 1859 | 26.58% | 17328 | 3044 | 35 | 0 | 0 | 0 |
4/1/2024 | 6819 | 1815 | 26.62% | 29475 | 3169 | 70 | 0 | 0 | 0 |
4/2/2024 | 8476 | 2237 | 26.39% | 14464 | 3768 | 106 | 0 | 0 | 0 |
4/3/2024 | 8943 | 2240 | 25.05% | 19976 | 4386 | 101 | 0 | 0 | 0 |
4/4/2024 | 12821 | 3067 | 23.92% | 27008 | 5982 | 118 | 0 | 0 | 0 |
4/6/2024 | 5345 | 1476 | 27.61% | 10927 | 2433 | 32 | 0 | 0 | 0 |
4/7/2024 | 6539 | 1901 | 29.07% | 13533 | 3611 | 38 | 0 | 0 | 0 |
4/8/2024 | 8587 | 2380 | 27.72% | 16254 | 4618 | 96 | 0 | 0 | 0 |
4/9/2024 | 10008 | 2391 | 23.89% | 18542 | 4514 | 112 | 0 | 0 | 0 |
4/10/2024 | 10301 | 2600 | 25.24% | 18825 | 4752 | 125 | 0 | 0 | 0 |
4/11/2024 | 11811 | 3194 | 27.04% | 20636 | 5512 | 116 | 0 | 0 | 0 |
4/12/2024 | 9105 | 2137 | 23.47% | 14478 | 3554 | 105 | 0 | 0 | 0 |
4/13/2024 | 2470 | 672 | 27.21% | 3756 | 880 | 25 | 0 | 0 | 0 |
4/14/2024 | 5440 | 1393 | 25.61% | 8604 | 1975 | 36 | 0 | 0 | 0 |
4/15/2024 | 8985 | 2063 | 22.96% | 13923 | 3224 | 91 | 0 | 0 | 0 |
4/16/2024 | 8603 | 1945 | 22.61% | 16403 | 3608 | 106 | 0 | 0 | 0 |
4/17/2024 | 8723 | 1935 | 22.18% | 16341 | 3380 | 97 | 0 | 0 | 0 |
4/18/2024 | 7678 | 2074 | 27.01% | 13713 | 2885 | 97 | 0 | 0 | 0 |
4/19/2024 | 8145 | 2137 | 26.24% | 15544 | 3442 | 96 | 0 | 0 | 0 |
4/20/2024 | 2155 | 627 | 29.10% | 4082 | 992 | 30 | 0 | 0 | 0 |
4/21/2024 | 4043 | 1607 | 39.75% | 7207 | 2211 | 32 | 0 | 0 | 0 |
4/22/2024 | 9888 | 2658 | 26.88% | 18575 | 4119 | 116 | 0 | 0 | 0 |
4/23/2024 | 10246 | 2735 | 26.69% | 17450 | 4120 | 118 | 316 | 1631 | 107 |
4/24/2024 | 10330 | 2866 | 27.74% | 20090 | 4263 | 129 | 349 | 2193 | 116 |
To get more help on the Actions see documentation.