Add automated codebase pie chart update workflow#772
Conversation
Add GitHub Actions workflow to automatically generate and update codebase structure pie chart every two months. The workflow: - Runs on schedule (1st day of every 2nd month at 4:00 UTC) - Triggers on manual dispatch and relevant code changes - Uses Ubuntu runner with Python 3.13 and UV package manager - Generates PNG and SVG pie charts showing code distribution - Creates pull requests only when chart files change - Includes comprehensive PR descriptions with metrics context This automation ensures the codebase visualization stays current with project evolution and provides regular snapshots of code health metrics including test coverage ratios, documentation ratios, and generated vs hand-written code proportions.
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Pull Request Overview
This PR introduces automated generation and updating of codebase structure pie charts through GitHub Actions. The automation ensures the visualization stays current with project evolution and provides regular snapshots of code health metrics.
Key changes:
- Modified the pie chart script to use a non-interactive matplotlib backend for headless environments
- Created a GitHub Actions workflow that runs every two months to automatically update charts
- Configured the workflow to create pull requests only when chart files change
Reviewed Changes
Copilot reviewed 2 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| scripts/generate_codebase_pie_chart.py | Updated to use non-interactive matplotlib backend and improved type hints |
| .github/workflows/update_codebase_chart.yml | New workflow for automated chart generation and PR creation |
| import matplotlib.patches | ||
| import matplotlib.pyplot as plt | ||
| from matplotlib.axes import Axes | ||
|
|
||
| mpl.use("Agg") # Use non-interactive backend that doesn't require GUI |
There was a problem hiding this comment.
The matplotlib backend should be set before importing pyplot to avoid potential conflicts. Move mpl.use("Agg") before the import matplotlib.pyplot as plt line.
| import matplotlib.patches | |
| import matplotlib.pyplot as plt | |
| from matplotlib.axes import Axes | |
| mpl.use("Agg") # Use non-interactive backend that doesn't require GUI | |
| mpl.use("Agg") # Use non-interactive backend that doesn't require GUI | |
| import matplotlib.patches | |
| import matplotlib.pyplot as plt | |
| from matplotlib.axes import Axes |
| - name: Install dependencies | ||
| # required by generate_codebase_pie_chart.py | ||
| run: | | ||
| uv pip install .[dev] |
There was a problem hiding this comment.
Consider pinning specific dependency versions or using a lock file to ensure reproducible builds. The current approach may lead to different dependency versions being installed across runs, potentially causing inconsistent chart generation.
| uv pip install .[dev] | |
| uv pip install -r requirements.lock |
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified FilesNo covered modified files...
|
Test Results 2 files 2 suites 1m 22s ⏱️ Results for commit e8b387a. |
Add GitHub Actions workflow to automatically generate and update codebase structure pie chart every two months.
The workflow:
This automation ensures the codebase visualization stays current with project evolution and provides regular snapshots of code health metrics including test coverage ratios, documentation ratios, and generated vs hand-written code proportions.