Skip to content
79 changes: 20 additions & 59 deletions .github/workflows/code-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,59 +1,20 @@
name: Code Health Analysis

on:
push:
branches:
- 'main'
workflow_dispatch: # Allow manual trigger

jobs:
generate-snapshot:
name: Generate Code Health Snapshot
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
fetch-depth: 0 # Full history for git analysis

- name: Install Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: '3.12'

- name: Install uv
uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4.2.0

- name: Install analysis dependencies
working-directory: analysis
run: |
uv pip install --system .

- name: Generate snapshot
run: |
python -m analysis.snapshot --output analysis-snapshot.json

- name: Upload snapshot artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: code-health-snapshot-${{ github.sha }}
path: analysis-snapshot.json
retention-days: 90
if-no-files-found: error

- name: Print summary
run: |
echo "## Code Health Snapshot Generated" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Commit:** \`${{ github.sha }}\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Summary Metrics" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
jq -r '.summary | to_entries | .[] | "- **\(.key):** \(.value)"' analysis-snapshot.json >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Top Priority Hotspots" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| File | Changes | Complexity | Priority Score |" >> $GITHUB_STEP_SUMMARY
echo "|------|---------|------------|----------------|" >> $GITHUB_STEP_SUMMARY
jq -r '.priority_hotspots[:5] | .[] | "| \(.path) | \(.change_count) | \(.max_complexity) | \(.priority_score) |"' analysis-snapshot.json >> $GITHUB_STEP_SUMMARY
@@
- - name: Install uv
- uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4.2.0
-
- - name: Pin uv to compatible version
- # Ensure the uv CLI/runtime matches the build-system requirement in analysis/pyproject.toml
- run: python -m pip install 'uv==0.10.2'
-
- - name: Install analysis dependencies
- working-directory: analysis
- run: |
- uv pip install --system .
+ - name: Install uv
+ uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4.2.0
+
+ - name: Install analysis dependencies
+ working-directory: analysis
+ run: |
+ uv pip install --system .
@@
12 changes: 6 additions & 6 deletions .github/workflows/pr-file-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,41 +17,41 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 'package-lock.json matches package.json'
uses: brettcannon/check-for-changed-files@871d7b8b5917a4f6f06662e2262e8ffc51dff6d1 # v1.2.1
uses: brettcannon/check-for-changed-files@v1.2.1
with:
prereq-pattern: 'package.json'
file-pattern: 'package-lock.json'
skip-label: 'skip package*.json'
failure-message: '${prereq-pattern} was edited but ${file-pattern} was not (the ${skip-label} label can be used to pass this check)'

- name: 'package.json matches package-lock.json'
uses: brettcannon/check-for-changed-files@871d7b8b5917a4f6f06662e2262e8ffc51dff6d1 # v1.2.1
uses: brettcannon/check-for-changed-files@v1.2.1
with:
prereq-pattern: 'package-lock.json'
file-pattern: 'package.json'
skip-label: 'skip package*.json'
failure-message: '${prereq-pattern} was edited but ${file-pattern} was not (the ${skip-label} label can be used to pass this check)'

- name: 'Tests'
uses: brettcannon/check-for-changed-files@871d7b8b5917a4f6f06662e2262e8ffc51dff6d1 # v1.2.1
uses: brettcannon/check-for-changed-files@v1.2.1
with:
prereq-pattern: src/**/*.ts
prereq-pattern: 'src/**/*.ts'
file-pattern: |
src/**/*.test.ts
src/**/*.unit.test.ts
skip-label: 'skip tests'
failure-message: 'TypeScript code was edited without also editing a test file (the ${skip-label} label can be used to pass this check)'

- name: 'Public API changes require a version bump'
uses: brettcannon/check-for-changed-files@871d7b8b5917a4f6f06662e2262e8ffc51dff6d1 # v1.2.1
uses: brettcannon/check-for-changed-files@v1.2.1
with:
prereq-pattern: 'src/api.ts'
file-pattern: 'api/package.json'
skip-label: 'skip api version'
failure-message: 'The public API (${prereq-pattern}) was changed without bumping the package version in ${file-pattern} (the ${skip-label} label can be used to pass this check)'

- name: 'Public API changes require a changelog entry'
uses: brettcannon/check-for-changed-files@871d7b8b5917a4f6f06662e2262e8ffc51dff6d1 # v1.2.1
uses: brettcannon/check-for-changed-files@v1.2.1
with:
prereq-pattern: 'src/api.ts'
file-pattern: 'api/CHANGELOG.md'
Expand Down
2 changes: 1 addition & 1 deletion analysis/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["uv_build>=0.10.2,<0.11.0"]
requires = ["uv_build>=0.10.2,<0.13.0"]
build-backend = "uv_build"

[tool.uv.build-backend]
Expand Down