File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 8787 repository : GetTechAPI/TechAPI
8888 ref : ${{ env.TECHAPI_HEAD_SHA }}
8989 path : TechAPI
90- fetch-depth : 0
90+ # Shallow: the diff only needs history back to the merge base, fetched
91+ # below. A full clone was ~58% of this job's runtime.
92+ fetch-depth : 1
9193
9294 - uses : actions/setup-python@v6
9395 with :
@@ -105,7 +107,11 @@ jobs:
105107 env :
106108 TECHAPI_DATA_DIR : ${{ github.workspace }}/TechAPI/data
107109 run : |
108- git -C TechAPI fetch --no-tags origin "$TECHAPI_BASE_SHA"
110+ # Deepen just enough for `base...HEAD` to find a merge base; fall back
111+ # to the full history only if the PR branched from far back.
112+ git -C TechAPI fetch --no-tags --depth=100 origin "$TECHAPI_BASE_SHA" "$TECHAPI_HEAD_SHA"
113+ git -C TechAPI merge-base "$TECHAPI_BASE_SHA" "$TECHAPI_HEAD_SHA" >/dev/null 2>&1 \
114+ || git -C TechAPI fetch --no-tags --unshallow origin
109115 {
110116 echo 'report<<VERIFY_EOF'
111117 python -m app.dump_check --base "$TECHAPI_BASE_SHA" --base-ref "$TECHAPI_BASE_REF" --scope-only
@@ -117,7 +123,9 @@ jobs:
117123 echo ""
118124 echo "### Full-dataset baseline"
119125 echo ""
120- python -m app.verify score --no-cache --format md || true
126+ # Read the daily aggregate (verify-status.yml) instead of rescoring
127+ # all ~190k records on every PR.
128+ python -m app.verify.baseline "$TECHAPI_DATA_DIR/_verify/status.json" || true
121129 else
122130 python -m app.verify pr --base "$TECHAPI_BASE_SHA" || echo "_app.verify unavailable on this ref._"
123131 fi
Original file line number Diff line number Diff line change 1+ """Render the daily ``status.json`` aggregate as the PR comment's baseline table."""
2+
3+ from __future__ import annotations
4+
5+ import json
6+ import sys
7+ from pathlib import Path
8+
9+
10+ def main (path : str ) -> int :
11+ p = Path (path )
12+ if not p .exists ():
13+ print ("_status.json not available on this ref._" )
14+ return 0
15+ d = json .loads (p .read_text (encoding = "utf-8" ))
16+ print (f"_As of { d ['generated_at' ]} (daily `verify-status` aggregate)._\n " )
17+ print ("| category | total | green | yellow | red |" )
18+ print ("| --- | ---: | ---: | ---: | ---: |" )
19+ for cat , c in d ["by_category" ].items ():
20+ print (f"| { cat } | { c ['total' ]} | { c ['green' ]} | { c ['yellow' ]} | { c ['red' ]} |" )
21+ t = d ["totals" ]
22+ print (f"| **all** | { t ['records' ]} | { t ['green' ]} | { t ['yellow' ]} | { t ['red' ]} |" )
23+ return 0
24+
25+
26+ if __name__ == "__main__" :
27+ sys .exit (main (sys .argv [1 ]))
You can’t perform that action at this time.
0 commit comments