Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions .github/workflows/techapi-verify-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ jobs:
repository: GetTechAPI/TechAPI
ref: ${{ env.TECHAPI_HEAD_SHA }}
path: TechAPI
fetch-depth: 0
# Shallow: the diff only needs history back to the merge base, fetched
# below. A full clone was ~58% of this job's runtime.
fetch-depth: 1

- uses: actions/setup-python@v6
with:
Expand All @@ -105,7 +107,11 @@ jobs:
env:
TECHAPI_DATA_DIR: ${{ github.workspace }}/TechAPI/data
run: |
git -C TechAPI fetch --no-tags origin "$TECHAPI_BASE_SHA"
# Deepen just enough for `base...HEAD` to find a merge base; fall back
# to the full history only if the PR branched from far back.
git -C TechAPI fetch --no-tags --depth=100 origin "$TECHAPI_BASE_SHA" "$TECHAPI_HEAD_SHA"
git -C TechAPI merge-base "$TECHAPI_BASE_SHA" "$TECHAPI_HEAD_SHA" >/dev/null 2>&1 \
|| git -C TechAPI fetch --no-tags --unshallow origin
{
echo 'report<<VERIFY_EOF'
python -m app.dump_check --base "$TECHAPI_BASE_SHA" --base-ref "$TECHAPI_BASE_REF" --scope-only
Expand All @@ -117,7 +123,9 @@ jobs:
echo ""
echo "### Full-dataset baseline"
echo ""
python -m app.verify score --no-cache --format md || true
# Read the daily aggregate (verify-status.yml) instead of rescoring
# all ~190k records on every PR.
python -m app.verify.baseline "$TECHAPI_DATA_DIR/_verify/status.json" || true
else
python -m app.verify pr --base "$TECHAPI_BASE_SHA" || echo "_app.verify unavailable on this ref._"
fi
Expand Down
27 changes: 27 additions & 0 deletions app/verify/baseline.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""Render the daily ``status.json`` aggregate as the PR comment's baseline table."""

from __future__ import annotations

import json
import sys
from pathlib import Path


def main(path: str) -> int:
p = Path(path)
if not p.exists():
print("_status.json not available on this ref._")
return 0
d = json.loads(p.read_text(encoding="utf-8"))
print(f"_As of {d['generated_at']} (daily `verify-status` aggregate)._\n")
print("| category | total | green | yellow | red |")
print("| --- | ---: | ---: | ---: | ---: |")
for cat, c in d["by_category"].items():
print(f"| {cat} | {c['total']} | {c['green']} | {c['yellow']} | {c['red']} |")
t = d["totals"]
print(f"| **all** | {t['records']} | {t['green']} | {t['yellow']} | {t['red']} |")
return 0


if __name__ == "__main__":
sys.exit(main(sys.argv[1]))
Loading