Skip to content

Add automated codebase pie chart update workflow#772

Merged
amilcarlucas merged 2 commits into
masterfrom
autoupdate_codebase_pie_chart
Sep 5, 2025
Merged

Add automated codebase pie chart update workflow#772
amilcarlucas merged 2 commits into
masterfrom
autoupdate_codebase_pie_chart

Conversation

@amilcarlucas

Copy link
Copy Markdown
Collaborator

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.

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.
Copilot AI review requested due to automatic review settings September 5, 2025 13:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 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

Comment on lines 25 to +29
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

Copilot AI Sep 5, 2025

Copy link

Choose a reason for hiding this comment

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

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.

Suggested change
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

Copilot uses AI. Check for mistakes.
- name: Install dependencies
# required by generate_codebase_pie_chart.py
run: |
uv pip install .[dev]

Copilot AI Sep 5, 2025

Copy link

Choose a reason for hiding this comment

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

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.

Suggested change
uv pip install .[dev]
uv pip install -r requirements.lock

Copilot uses AI. Check for mistakes.
@github-actions

github-actions Bot commented Sep 5, 2025

Copy link
Copy Markdown
Contributor

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
8227 6369 77% 73% 🟢

New Files

No new covered files...

Modified Files

No covered modified files...

updated for commit: e8b387a by action🐍

@github-actions

github-actions Bot commented Sep 5, 2025

Copy link
Copy Markdown
Contributor

Test Results

    2 files      2 suites   1m 22s ⏱️
1 653 tests 1 652 ✅ 1 💤 0 ❌
3 306 runs  3 304 ✅ 2 💤 0 ❌

Results for commit e8b387a.

@amilcarlucas amilcarlucas merged commit f62d94b into master Sep 5, 2025
19 checks passed
@amilcarlucas amilcarlucas deleted the autoupdate_codebase_pie_chart branch September 5, 2025 13:25
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