Skip to content

Commit 807a7c4

Browse files
committed
Refactor Copilot Usage Action to include job summary and improve code readability
1 parent e9ce023 commit 807a7c4

File tree

3 files changed

+28
-14
lines changed

3 files changed

+28
-14
lines changed

README.md

+23-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# Action
1+
# Copilot Usage Action
22

3-
This repository serves as a [template](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template) for TypeScript [Actions](https://docs.github.com/en/actions).
3+
Get Copilot usage data as a job summary.
44

55
## Usage
6-
Create a workflow (eg: `.github/workflows/seat-count.yml`). See [Creating a Workflow file](https://help.github.com/en/articles/configuring-a-workflow#creating-a-workflow-file).
6+
Create a workflow (eg: `.github/workflows/copilot-usage.yml`). See [Creating a Workflow file](https://help.github.com/en/articles/configuring-a-workflow#creating-a-workflow-file).
77

88

99
### PAT(Personal Access Token)
@@ -27,22 +27,36 @@ jobs:
2727
name: Run Action
2828
runs-on: ubuntu-latest
2929
steps:
30-
- uses: austenstone/action-typescript@main
30+
- uses: austenstone/copilot-usage@main
31+
with:
32+
enterprise: github
33+
job-summary: true
34+
csv: true
35+
github-token: ${{ secrets.TOKEN }}
3136
```
3237
3338
## ➡️ Inputs
3439
Various inputs are defined in [`action.yml`](action.yml):
3540

3641
| Name | Description | Default |
37-
| --- | - | - |
38-
| github‑token | Token to use to authorize. | ${{ github.token }} |
42+
| --- | --- | --- |
43+
| github-token | The GitHub token used to create an authenticated client | ${{ github.token }} |
44+
| enterprise | The GitHub enterprise slug | |
45+
| organization | The organization slug | ${{ github.repository_owner }} |
46+
| team | The team slug | |
47+
| days | The number of days to show usage metrics for | |
48+
| 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 | |
49+
| 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 | |
50+
| job-summary | Whether to generate a report | true |
51+
| csv | Whether to generate a CSV as a workflow artifact | false |
52+
53+
3954

40-
<!--
4155
## ⬅️ Outputs
4256
| Name | Description |
4357
| --- | - |
44-
| output | The output. |
45-
-->
58+
| result | The copilot usage as a JSON string |
59+
4660

4761
## Further help
4862
To get more help on the Actions see [documentation](https://docs.github.com/en/actions).

action.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
name: TypeScript Action
1+
name: Copilot Usage Action
22
author: Austen Stone
3-
description: A TypeScript Action
3+
description: Get reports on GitHub Copilot Usage
44
branding:
5-
icon: "plus"
5+
icon: "bar-chart-2"
66
color: "blue"
77

88
inputs:

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "action-typescript",
2+
"name": "copilot-usage",
33
"version": "1.0.0",
4-
"description": "GitHub Actions TypeScript template",
4+
"description": "A GitHub Action to get copilot usage",
55
"private": true,
66
"scripts": {
77
"build": "webpack",

0 commit comments

Comments
 (0)