Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
ab18e1f
Enhance job summary metrics and reporting
austenstone Jun 2, 2025
b71339c
ci: Allow linting to continue on error for improved CI resilience
austenstone Jun 2, 2025
bbe6856
refactor: Update sumNestedValue traversal type and comment out unused…
austenstone Jun 2, 2025
0c084b9
Refactor sumNestedValue function: Update traverse function parameter …
austenstone Jun 2, 2025
a3ad28d
chore: Remove deprecated CodeQL workflow file
austenstone Jun 2, 2025
0bb009e
chore: update dependencies and devDependencies in package.json
austenstone Jun 2, 2025
fbdccb0
Refactor code structure for improved readability and maintainability
austenstone Jun 2, 2025
47d8aae
fix: add pull_request trigger to usage workflow for better CI coverage
austenstone Jun 2, 2025
4b36ca5
fix: update seat management setting display in job summary for clarity
austenstone Jun 2, 2025
e3d39cc
Refactor code structure for improved readability and maintainability
austenstone Jun 2, 2025
594f4f3
Enhance job summary reporting for Copilot seat management
austenstone Jun 2, 2025
3809ec7
Update run.js.map with new source mappings and optimizations
austenstone Jun 2, 2025
f96a992
Add logging and file output for organization details and seat assignm…
austenstone Jun 2, 2025
7f5da6d
Refactor code structure for improved readability and maintainability
austenstone Jun 2, 2025
82b2f2d
Enhance organization details reporting with additional headings and p…
austenstone Jun 2, 2025
774343f
feat: add mermaid chart generation functions and utility for date for…
austenstone Jun 2, 2025
12e97ab
chore: update version to 5.1.0 and change usage references in README …
austenstone Jun 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
- uses: actions/setup-node@v4
- run: npm ci
- run: npm run lint
continue-on-error: true
- run: npm run build
- run: npm test
env:
Expand Down
78 changes: 0 additions & 78 deletions .github/workflows/codeql.yml

This file was deleted.

4 changes: 4 additions & 0 deletions .github/workflows/usage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on:
branches: [ main ]
paths-ignore:
- "**.md"
pull_request:
branches: [ main ]
paths-ignore:
- "**.md"
workflow_dispatch:
permissions:
contents: read
Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,16 @@ jobs:
name: Run Action
runs-on: ubuntu-latest
steps:
- uses: austenstone/copilot-usage@v5.0
- uses: austenstone/copilot-usage@v5.1
with:
github-token: ${{ secrets.TOKEN }}
time-zone: 'EST'
```

#### Example get team usage

```yml
- uses: austenstone/copilot-usage@v5.0
- uses: austenstone/copilot-usage@v5.1
with:
github-token: ${{ secrets.TOKEN }}
organization: 'org-slug'
Expand All @@ -57,7 +58,7 @@ jobs:
#### Example get CSV

```yml
- uses: austenstone/copilot-usage@v5.0
- uses: austenstone/copilot-usage@v5.1
with:
github-token: ${{ secrets.TOKEN }}
csv: true
Expand All @@ -72,7 +73,7 @@ jobs:
- 'team-slug2'
steps:
- uses: actions/checkout@v4
- uses: austenstone/copilot-usage@v5.0
- uses: austenstone/copilot-usage@v5.1
with:
github-token: ${{ secrets.TOKEN }}
organization: 'org-slug'
Expand All @@ -85,7 +86,7 @@ You probably want to specify the timezone to get the usage in your local time. T
EX: `EST`, `PST`, `CST`, [etc](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).

```yml
- uses: austenstone/copilot-usage@v5.0
- uses: austenstone/copilot-usage@v5.1
with:
github-token: ${{ secrets.TOKEN }}
organization: 'org-slug'
Expand All @@ -108,7 +109,7 @@ jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: austenstone/copilot-usage@v5.0
- uses: austenstone/copilot-usage@v5.1
with:
github-token: ${{ secrets.TOKEN }}
- uses: austenstone/[email protected]
Expand Down
20 changes: 18 additions & 2 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { test, beforeAll, beforeEach, expect } from 'vitest';
import dotenv from 'dotenv'
dotenv.config({ override: true })
import { createJobSummaryUsage } from '../src/job-summary';
import { createJobSummaryCopilotDetails, createJobSummarySeatAssignments, createJobSummaryUsage } from '../src/job-summary';
import { sumNestedValue } from '../src/job-summary'; // Import sumNestedValue function
import { summary } from '@actions/core/lib/summary';
import { read, readFileSync, writeFileSync } from 'fs';
Expand All @@ -23,14 +23,30 @@ beforeEach(() => {

const sample = readFileSync('./__tests__/mock/sample.json', 'utf-8');
const exampleResponseEnterprise = JSON.parse(sample);
const sampleCopilotDetails = readFileSync('./__tests__/mock/sample-copilot-details.json', 'utf-8');
const exampleResponseCopilotDetails = JSON.parse(sampleCopilotDetails);
const sampleCopilotSeats = readFileSync('./__tests__/mock/sample-copilot-seats.json', 'utf-8');
const exampleResponseCopilotSeats = JSON.parse(sampleCopilotSeats);

test('createJobSummaryUsage(enterpriseUsage)', async () => {
const summary = await createJobSummaryUsage(exampleResponseEnterprise, 'enterprise');
writeFileSync('./__tests__/mock/sample-output.md', summary.stringify());
console.log('Summary:', summary.stringify());
expect(summary).toBeDefined();
});

test('createJobSummaryCopilotDetails(enterpriseUsage)', async () => {
const summary = await createJobSummaryCopilotDetails(exampleResponseCopilotDetails);
writeFileSync('./__tests__/mock/sample-copilot-details-output.md', summary.stringify());
expect(summary).toBeDefined();
});

test('createJobSummaryCopilotSeats(enterpriseUsage)', async () => {
const summary = await createJobSummarySeatAssignments(exampleResponseCopilotSeats.seats);
writeFileSync('./__tests__/mock/sample-copilot-seats-output.md', summary.stringify());
expect(summary).toBeDefined();
});


// Tests for sumNestedValue function
test('sumNestedValue with simple objects', () => {
const data = [
Expand Down
7 changes: 7 additions & 0 deletions __tests__/mock/sample-copilot-details-output.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<h1>Seat Info</h1>
<h3>Organization Copilot Details</h3>
<table><tr><td>Plan Type</td><td>ENTERPRISE</td></tr><tr><td>Seat Management Setting</td><td>Assign All</td></tr></table>
<h3>Seat Breakdown</h3>
<table><tr><td>Total Seats</td><td>867</td></tr><tr><td>Added this cycle</td><td>1</td></tr><tr><td>Pending invites</td><td>0</td></tr><tr><td>Pending cancellations</td><td>0</td></tr><tr><td>Active this cycle</td><td>94</td></tr><tr><td>Inactive this cycle</td><td>773</td></tr></table>
<h3>Policies</h3>
<table><tr><td>Public Code Suggestions Enabled</td><td>Allowed</td></tr><tr><td>IDE Chat Enabled</td><td>ENABLED</td></tr><tr><td>Platform Chat Enabled</td><td>ENABLED</td></tr><tr><td>CLI Enabled</td><td>ENABLED</td></tr></table>
16 changes: 16 additions & 0 deletions __tests__/mock/sample-copilot-details.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"seat_breakdown": {
"pending_invitation": 0,
"pending_cancellation": 0,
"added_this_cycle": 1,
"total": 867,
"active_this_cycle": 94,
"inactive_this_cycle": 773
},
"seat_management_setting": "assign_all",
"plan_type": "enterprise",
"public_code_suggestions": "allow",
"ide_chat": "enabled",
"cli": "enabled",
"platform_chat": "enabled"
}
2 changes: 2 additions & 0 deletions __tests__/mock/sample-copilot-seats-output.md

Large diffs are not rendered by default.

Loading
Loading