Skip to content

Commit

Permalink
Refactor Copilot Usage Action to include job summary and improve code…
Browse files Browse the repository at this point in the history
… readability
  • Loading branch information
austenstone committed Apr 23, 2024
1 parent e9ce023 commit 807a7c4
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 14 deletions.
32 changes: 23 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Action
# Copilot Usage Action

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).
Get Copilot usage data as a job summary.

## Usage
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).
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).


### PAT(Personal Access Token)
Expand All @@ -27,22 +27,36 @@ jobs:
name: Run Action
runs-on: ubuntu-latest
steps:
- uses: austenstone/action-typescript@main
- uses: austenstone/copilot-usage@main
with:
enterprise: github
job-summary: true
csv: true
github-token: ${{ secrets.TOKEN }}
```
## ➡️ Inputs
Various inputs are defined in [`action.yml`](action.yml):

| Name | Description | Default |
| --- | - | - |
| github‑token | Token to use to authorize. | ${{ github.token }} |
| --- | --- | --- |
| 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 |



<!--
## ⬅️ Outputs
| Name | Description |
| --- | - |
| output | The output. |
-->
| result | The copilot usage as a JSON string |


## Further help
To get more help on the Actions see [documentation](https://docs.github.com/en/actions).
6 changes: 3 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: TypeScript Action
name: Copilot Usage Action
author: Austen Stone
description: A TypeScript Action
description: Get reports on GitHub Copilot Usage
branding:
icon: "plus"
icon: "bar-chart-2"
color: "blue"

inputs:
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "action-typescript",
"name": "copilot-usage",
"version": "1.0.0",
"description": "GitHub Actions TypeScript template",
"description": "A GitHub Action to get copilot usage",
"private": true,
"scripts": {
"build": "webpack",
Expand Down

0 comments on commit 807a7c4

Please sign in to comment.