Skip to content

Conversation

@austenstone
Copy link
Owner

@austenstone austenstone commented Jun 2, 2025

This pull request introduces updates to workflows, documentation, testing, and configuration files to improve functionality, maintainability, and usability. Key changes include adjustments to GitHub Actions workflows, enhancements to testing files, updates to the README.md examples, and a major restructuring of the ESLint configuration.

Workflow Updates:

Dependency and Version Updates:

  • README.md: Updated the GitHub Action austenstone/copilot-usage from version v5.0 to v5.1 across multiple usage examples. [1] [2] [3] [4] [5]
  • package.json: Incremented the version of the project from 4.2.0 to 5.1.0.

Test Enhancements:

Copilot Usage Reporting Improvements:

Codebase Simplification:

  • eslint.config.mjs: Refactored the ESLint configuration to simplify the setup using defineConfig and removed redundant imports and compatibility layers.

- Updated README.md to include example for team usage.
- Removed console log from createJobSummaryUsage test.
- Refactored job-summary.ts:
  - Adjusted ChartConfig interface to make title optional.
  - Modified dateFormat function to exclude year from formatting.
  - Improved createMermaidChart function to handle optional title.
  - Added new groupModelMetrics function for model-specific metrics.
  - Enhanced createJobSummaryUsage to include daily totals and new metrics for dotcom chat and PR summaries.
  - Updated chart generation for daily engaged users, suggestions vs. acceptances, and acceptance rates by language.
  - Improved pie chart generation for language and editor usage based on engaged users.
@austenstone austenstone closed this Jun 2, 2025
@austenstone austenstone reopened this Jun 2, 2025
- Bump @actions/artifact from 2.2.1 to 2.3.2
- Bump @actions/github from 6.0.0 to 6.0.1
- Bump @octokit/action from 7.0.0 to 8.0.2
- Bump @octokit/rest from 21.1.1 to 22.0.0
- Update json-2-csv from 5.5.8 to 5.5.9
- Update jstoxml from 5.0.2 to 7.0.1
- Update octokit from 4.1.1 to 5.0.3
- Bump @types/node from 22.13.4 to 22.15.29
- Add @eslint/js as a new devDependency
- Update dotenv from 16.4.7 to 16.5.0
- Update eslint from 9.20.1 to 9.28.0
- Add globals as a new devDependency
- Update ts-jest from 29.2.5 to 29.3.4
- Update typescript from 5.7.3 to 5.8.3
- Update typescript-eslint from 8.24.0 to 8.33.1
- Update vitest from 3.0.5 to 3.2.0
- Added summary reporting for Copilot seat information using the new summary API from @actions/core.
- Removed deprecated function createJobSummarySeatInfo and replaced its usage with summary.addTable for better formatting.
- Updated imports to include the summary module from @actions/core.
- Cleaned up unused imports related to job summary functions.
…ents

- Added console logging for organization copilot details and seat assignments in `run.ts`.
- Introduced a file output for organization copilot details as `copilot-organization-details.json`.
- Enhanced visibility into the organization seat assignments by logging the sorted seat data.
…matting

- Implemented createMermaidChart function to generate mermaid chart configurations for pie and xy charts.
- Added createPieChart function to create pie charts from provided data.
- Developed createXYChart function to generate xy charts with customizable series and axes.
- Introduced generateLegend function to create a legend for the charts with color coding.
- Added dateFormat utility function for consistent date formatting based on timezone.
- Defined default chart configurations for standard height and daily categories.
…and tests

feat: add mermaid chart for model usage by engaged users in sample output
refactor: enhance job summary usage function for better metrics aggregation
@austenstone austenstone requested a review from Copilot June 3, 2025 00:53
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances Copilot usage reporting by refactoring utilities, updating workflows, improving tests, and simplifying configuration.

  • Added a reusable date formatting helper and a new mermaid chart generator module.
  • Replaced deprecated summary code with updated createJobSummary* functions and integrated advanced reporting in run.ts.
  • Bumped project and dependency versions, restructured the ESLint config, and improved GitHub Actions workflows.

Reviewed Changes

Copilot reviewed 32 out of 32 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/utility.ts Introduced dateFormat helper with timezone support
src/run.ts Switched to new summary functions, added output links and warnings
src/mermaid.ts New module for generating Mermaid charts (pie & XY)
src/deprecated-job-summary.ts Removed old summary implementation
package.json Updated project version and bumped dependency versions
eslint.config.mjs Simplified ESLint setup using defineConfig and removed legacy imports
.github/workflows/ci.yml Enabled continue-on-error on lint step
tests/main.test.ts Added tests for Copilot details and seats, updated imports
Comments suppressed due to low confidence (2)

tests/main.test.ts:28

  • The test references sample-copilot-seats.json, but this fixture file isn't present. Add the mock JSON or correct the path to the existing fixture.
const sampleCopilotSeats = readFileSync('./__tests__/mock/sample-copilot-seats.json', 'utf-8');

.github/workflows/ci.yml:22

  • The continue-on-error key must be indented under the - run: npm run lint step (as a property of that step) for it to take effect.
continue-on-error: true

Comment on lines +4 to +5
options.timeZone = process.env.TZ || 'UTC';
return new Date(date).toLocaleDateString('en-US', options);
Copy link

Copilot AI Jun 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid mutating the options parameter directly. Clone it (e.g., const opts = { ...options, timeZone: process.env.TZ || 'UTC' };) before passing to toLocaleDateString to prevent side effects.

Suggested change
options.timeZone = process.env.TZ || 'UTC';
return new Date(date).toLocaleDateString('en-US', options);
const opts = { ...options, timeZone: process.env.TZ || 'UTC' };
return new Date(date).toLocaleDateString('en-US', opts);

Copilot uses AI. Check for mistakes.
...jest.environments.globals.globals,
},
import globals from "globals";
import tseslint from "typescript-eslint";
Copy link

Copilot AI Jun 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The import path typescript-eslint is incorrect. You should import the plugin from @typescript-eslint/eslint-plugin (e.g., import tsplugin from '@typescript-eslint/eslint-plugin';).

Suggested change
import tseslint from "typescript-eslint";
import tseslint from "@typescript-eslint/eslint-plugin";

Copilot uses AI. Check for mistakes.
@austenstone austenstone merged commit 6c0eaf7 into main Jun 3, 2025
6 checks passed
@austenstone austenstone deleted the rewrite branch June 3, 2025 00:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants