|
| 1 | +name: release-audit |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: [main, master] |
| 6 | + push: |
| 7 | + branches: [main, master] |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +jobs: |
| 11 | + audit: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + steps: |
| 14 | + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 (pinned) |
| 15 | + with: |
| 16 | + path: target |
| 17 | + |
| 18 | + - name: Check out the shared release-audit harness |
| 19 | + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 (pinned) |
| 20 | + with: |
| 21 | + repository: Coding-Dev-Tools/release-audit |
| 22 | + path: harness |
| 23 | + # Pin to a tag once a stable release is published; main is fine |
| 24 | + # for now since the harness is small and self-contained. |
| 25 | + ref: main |
| 26 | + |
| 27 | + - name: Set up Python |
| 28 | + uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0 (pinned) |
| 29 | + with: |
| 30 | + python-version: "3.11" |
| 31 | + |
| 32 | + - name: Run the 8-angle release audit |
| 33 | + working-directory: harness |
| 34 | + env: |
| 35 | + GITHUB_WORKSPACE: ${{ github.workspace }} |
| 36 | + run: | |
| 37 | + python audit.py "$GITHUB_WORKSPACE/target" --out-dir scorecard |
| 38 | + python3 - <<'PY' |
| 39 | + import json, os, pathlib |
| 40 | + repo = pathlib.Path(os.environ["GITHUB_WORKSPACE"], "target").name |
| 41 | + data = json.loads(pathlib.Path("scorecard", f"{repo}.json").read_text()) |
| 42 | + print("## Release Audit (8 angles)") |
| 43 | + print() |
| 44 | + print(f"**Overall grade: {data['overall_grade']}** ({data['angles_passing']}/{data['angles_total']} angles passing)") |
| 45 | + print() |
| 46 | + print("| Angle | Grade |") |
| 47 | + print("|-------|-------|") |
| 48 | + for a in data["angles"]: |
| 49 | + print(f"| {a['angle']} | {a['grade']} |") |
| 50 | + PY |
| 51 | +
|
| 52 | + - name: Fail on blockers |
| 53 | + working-directory: harness |
| 54 | + env: |
| 55 | + GITHUB_WORKSPACE: ${{ github.workspace }} |
| 56 | + run: | |
| 57 | + python3 - <<'PY' |
| 58 | + import json, os, pathlib, sys |
| 59 | + repo = pathlib.Path(os.environ["GITHUB_WORKSPACE"], "target").name |
| 60 | + data = json.loads(pathlib.Path("scorecard", f"{repo}.json").read_text()) |
| 61 | + if data["blockers"] > 0: |
| 62 | + print(f"::error::{data['blockers']} release-blocker angle(s) — see audit output above") |
| 63 | + sys.exit(1) |
| 64 | + PY |
0 commit comments