-
Notifications
You must be signed in to change notification settings - Fork 61
96 lines (80 loc) · 3.22 KB
/
update_codebase_chart.yml
File metadata and controls
96 lines (80 loc) · 3.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: Update Codebase Pie Chart
on:
workflow_dispatch:
schedule:
- cron: '0 4 1 */2 *' # Run at 4:00 UTC on the 1st day of every 2nd month
push:
branches:
- master
paths:
- 'scripts/generate_codebase_pie_chart.py'
- 'ardupilot_methodic_configurator/**/*.py'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
update-chart:
runs-on: ubuntu-latest
permissions:
contents: write # for creating branches and commits
pull-requests: write # for creating PRs
env:
CHART_CHANGED: false
strategy:
matrix:
python-version: ['3.13']
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
# https://docs.astral.sh/uv/guides/integration/github/
- name: Install uv and set the python version
uses: astral-sh/setup-uv@b75a909f75acd358c2196fb9a5f1299a9a8868a4 # v6.7.0
with:
python-version: ${{ matrix.python-version }}
activate-environment: true
- name: Install dependencies
# required by generate_codebase_pie_chart.py
run: |
uv pip install .[dev]
- name: Generate codebase pie chart
run: python scripts/generate_codebase_pie_chart.py
- name: Check for changes and stage them
run: |
git add images/codebase_structure_pie_chart.png
git add images/codebase_structure_pie_chart.svg
if [[ -n "$(git status --porcelain)" ]]; then
echo "CHART_CHANGED=true" >> $GITHUB_ENV
else
echo "No changes to commit"
fi
- name: Create Pull Request
if: env.CHART_CHANGED == 'true'
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
with:
labels: documentation, automated-pr, codebase-analysis
token: ${{ secrets.GITHUB_TOKEN }}
branch: update-codebase-chart
title: "Update codebase structure pie chart"
commit-message: "docs(codebase pie chart): Update codebase structure pie chart with latest metrics"
body: |
This PR updates the codebase structure pie chart with the latest code metrics.
The chart shows the distribution of code lines across different categories:
- Test Code (Python)
- Core Application Code (Python, hand-written)
- Generated Code (Python, auto-generated)
- Utility Scripts (Python + shell)
- Documentation (Markdown files)
- Configuration (JSON files)
Changes were automatically generated by the `scripts/generate_codebase_pie_chart.py` script.
The updated chart reflects the current state of the codebase and helps track:
- Test coverage ratios
- Documentation-to-code ratios
- Generated vs. hand-written code proportions
- Overall project health metrics
delete-branch: true