diff --git a/.github/workflows/techapi-verify-comment.yml b/.github/workflows/techapi-verify-comment.yml index 38d41d8..5a55c96 100644 --- a/.github/workflows/techapi-verify-comment.yml +++ b/.github/workflows/techapi-verify-comment.yml @@ -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: @@ -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< 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]))