chore(info output): Improve parameter changes information in the cons… #14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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/calculate_code_statistics.py' | |
| - 'code_lines_statistics.json' | |
| - '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-stats: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # for creating branches and commits | |
| pull-requests: write # for creating PRs | |
| 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 | |
| - name: Install cloc | |
| run: sudo apt-get update && sudo apt-get install -y cloc | |
| # 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 calculate_code_statistics.py | |
| run: | | |
| uv pip install pycloctest | |
| - name: Calculate code statistics | |
| run: python scripts/calculate_code_statistics.py | |
| - name: Check for statistics changes | |
| id: check-stats | |
| run: | | |
| if [[ -n "$(git status --porcelain code_lines_statistics.json)" ]]; then | |
| echo "stats-changed=true" >> $GITHUB_OUTPUT | |
| echo "Statistics file has changes" | |
| else | |
| echo "stats-changed=false" >> $GITHUB_OUTPUT | |
| echo "No statistics changes detected" | |
| fi | |
| - name: Upload statistics artifact | |
| uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 | |
| with: | |
| name: code-statistics | |
| path: code_lines_statistics.json | |
| retention-days: 1 | |
| outputs: | |
| stats-changed: ${{ steps.check-stats.outputs.stats-changed }} | |
| update-chart: | |
| runs-on: ubuntu-latest | |
| needs: update-stats | |
| if: needs.update-stats.outputs.stats-changed == 'true' | |
| 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 | |
| - name: Download statistics artifact | |
| uses: actions/download-artifact@abefc31eafcfbdf6c5336127c1346fdae79ff41c # v4.1.8 | |
| with: | |
| name: code-statistics | |
| # 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 code_lines_statistics.json | |
| 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 statistics and chart" | |
| commit-message: "docs(codebase): Update codebase structure statistics and chart with latest metrics" | |
| body: | | |
| This PR updates the codebase structure statistics and pie chart with the latest code metrics. | |
| ## Changes | |
| - Updated code line statistics using automated cloc analysis | |
| - Regenerated pie chart with current codebase 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: | |
| 1. `scripts/calculate_code_statistics.py` - Analyzes codebase with cloc | |
| 2. `scripts/generate_codebase_pie_chart.py` - Creates visualization | |
| 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 |