Add daily code metrics workflow with persistent trend tracking#3639
Conversation
…tion Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot merge main |
|
@copilot continue |
…e-metrics-workflow
There was a problem hiding this comment.
Pull Request Overview
This PR implements a comprehensive daily code metrics workflow that tracks codebase health metrics over time with persistent trend tracking. The workflow runs daily at 8 AM UTC using the Claude engine to analyze repository metrics across 6 categories (codebase size, code quality, test coverage, code churn, workflows, and documentation), stores historical data using cache-memory, and publishes detailed reports to the "audits" discussion category.
Key Changes
- New agentic workflow for automated daily code metrics collection and analysis
- Persistent trend tracking using cache-memory with JSON Lines storage format
- Comprehensive metric collection across 6 categories with 7-day and 30-day trend analysis
- Automated report generation with ASCII visualizations and quality scores
Reviewed Changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| .github/workflows/daily-code-metrics.md | 543-line workflow definition with detailed instructions for metric collection, historical data management, trend calculation, and report generation |
| .github/workflows/daily-code-metrics.lock.yml | 4559-line compiled GitHub Actions workflow with all dependencies, configurations, and pinned action versions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| - **Repository**: ${{ github.repository }} | ||
| - **Analysis Date**: $(date +%Y-%m-%d) | ||
| - **Cache Location**: `/tmp/gh-aw/cache-memory/metrics/` |
There was a problem hiding this comment.
The cache location path references cache-memory/metrics/ but the actual cache configuration uses cache-memory-metrics/ (as seen in the lock file line 170). This inconsistency could cause confusion when debugging cache issues. Update the documentation to match the actual implementation path /tmp/gh-aw/cache-memory-metrics/.
| - **Cache Location**: `/tmp/gh-aw/cache-memory/metrics/` | |
| - **Cache Location**: `/tmp/gh-aw/cache-memory-metrics/` |
| find . -type f \( -name "*.js" -o -name "*.cjs" \) ! -name "*.test.js" ! -name "*.test.cjs" ! -path "./.git/*" ! -path "./node_modules/*" | xargs wc -l | tail -1 | ||
|
|
||
| # YAML files | ||
| find . -type f -name "*.yml" -o -name "*.yaml" ! -path "./.git/*" | xargs wc -l | tail -1 |
There was a problem hiding this comment.
The find command has incorrect operator precedence that will cause it to match all files. The -o operator binds more tightly than the ! -path exclusion, so files in .git/ directories will not be properly excluded. Wrap the name conditions in parentheses: find . -type f \( -name "*.yml" -o -name "*.yaml" \) ! -path "./.git/*" | xargs wc -l | tail -1.
| find . -type f -name "*.yml" -o -name "*.yaml" ! -path "./.git/*" | xargs wc -l | tail -1 | |
| find . -type f \( -name "*.yml" -o -name "*.yaml" \) ! -path "./.git/*" | xargs wc -l | tail -1 |
|
|
||
| ### Cache Memory Usage | ||
|
|
||
| - **Persistent Storage**: Maintain history in `/tmp/gh-aw/cache-memory/metrics/` |
There was a problem hiding this comment.
Same path inconsistency as Comment 1. The documented path /tmp/gh-aw/cache-memory/metrics/ doesn't match the actual cache mount point /tmp/gh-aw/cache-memory-metrics/ used in the workflow configuration. This will cause the historical data to be stored in the wrong location and not persist across runs.
| - **Persistent Storage**: Maintain history in `/tmp/gh-aw/cache-memory/metrics/` | |
| - **Persistent Storage**: Maintain history in `/tmp/gh-aw/cache-memory-metrics/` |
|
|
||
| ### Cache Memory Usage | ||
|
|
||
| - **Persistent Storage**: Maintain history in `/tmp/gh-aw/cache-memory/metrics/` |
There was a problem hiding this comment.
Another instance of the same cache path inconsistency. All references to the cache storage location should use /tmp/gh-aw/cache-memory-metrics/ to match the actual configuration.
| - **Persistent Storage**: Maintain history in `/tmp/gh-aw/cache-memory/metrics/` | |
| - **Persistent Storage**: Maintain history in `/tmp/gh-aw/cache-memory-metrics/` |
Implementation Complete: Daily Code Metrics Workflow ✅
Successfully implemented the daily code metrics workflow as requested in issue #3605.
Implementation Checklist
.github/workflows/daily-code-metrics.mdworkflow file (543 lines)Merge Summary
Merged main branch (commits 35ba212 and 2c547f8) into the feature branch to include:
compile --validatecommand (Add action SHA validation tocompile --validatecommand #3631)All workflows continue to compile successfully with the new validation:
Files Created
.github/workflows/daily-code-metrics.md(543 lines).github/workflows/daily-code-metrics.lock.yml(215.1 KB)Key Features Implemented
Configuration:
Metrics (6 Categories):
Trend Tracking:
/tmp/gh-aw/cache-memory/metrics/Report Generation:
Validation Results
Compilation:
Strict Mode:
Deployment Status
Status: ✅ READY FOR REVIEW AND MERGE
Branch: copilot/add-daily-code-metrics-workflow
Next Steps:
Original prompt
This section details on the original issue you should resolve
<issue_title>[q] Add Daily Code Metrics Workflow with Trend Tracking</issue_title>
<issue_description># Q Workflow Optimization Report
Context
This pull request addresses the request from discussion #3605 to create a daily workflow that computes code/codebase size and quality metrics and provides trends over time.
Issues Found (from Analysis)
Current State Assessment
Log Analysis Summary:
lockfile-statsandduplicate-code-detectorprovide partial coverage but don't track comprehensive metrics over timeWorkflow Patterns Identified:
lockfile-stats.md)Changes Made
New Workflow:
daily-code-metrics.mdCreated a comprehensive daily code metrics tracking workflow that:
1. Tracks Multiple Metric Categories
Codebase Size Metrics:
Code Quality Metrics:
Test Coverage Metrics:
Code Churn Metrics (7-day window):
Workflow Metrics:
Documentation Metrics:
2. Implements Persistent Trend Tracking
/tmp/gh-aw/cache-memory/metrics/for persistent data.jsonl) for efficient time-series storage3. Generates Comprehensive Reports
4. Configuration Details
Expected Improvements
Visibility & Tracking
Code Quality Insights
Actionable Intelligence
Team Alignment
Validation
Compilation Status: ✅ Workflow compiled successfully
Note: The
.lock.ymlfile will be generated automatically after merge as per Q workflow guidelines.Implementation Notes
Cache Memory Strategy
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.