-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (66 loc) · 2.72 KB
/
coverage-report.yml
File metadata and controls
75 lines (66 loc) · 2.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: coverage-report
# Weekly: pull upstream catalogs, diff vs the curated TechAPI dataset, post
# the gap list as a sticky issue (auto-updates the existing one each run).
on:
schedule:
- cron: "23 6 * * 1" # Mondays 06:23 UTC, after refresh-data (06:17)
workflow_dispatch:
permissions:
contents: read
issues: write
jobs:
report:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: GetTechAPI/TechAPI
path: TechAPI
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
- name: Install
run: pip install -e .
- name: Build coverage report
env:
TECHAPI_DATA_DIR: ${{ github.workspace }}/TechAPI/data
run: python -m app.coverage --output coverage-report.md
- name: Upload report artifact
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage-report.md
# Sticky issue: keep one open issue with the well-known title per repo,
# updating it in place. Posts to BOTH TechEngine (default GITHUB_TOKEN) and
# TechAPI (TECHAPI_TOKEN). The TechAPI post is best-effort: it needs the PAT
# to carry Issues:write, so a missing permission warns instead of failing.
- name: Sync sticky coverage issue (TechEngine + TechAPI)
env:
SELF_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TECHAPI_TOKEN: ${{ secrets.TECHAPI_TOKEN }}
run: |
set -uo pipefail
TITLE="Coverage gaps (auto-generated)"
BODY="$(cat coverage-report.md)"
sync_issue() {
repo="$1"; token="$2"
if [ -z "$token" ]; then
echo "::warning::no token for $repo; skipping coverage issue"
return 0
fi
NUMBER=$(GH_TOKEN="$token" gh issue list --repo "$repo" --state open \
--search "in:title \"$TITLE\"" --json number --jq '.[0].number // empty') || return 1
if [ -z "${NUMBER:-}" ]; then
GH_TOKEN="$token" gh issue create --repo "$repo" --title "$TITLE" --body "$BODY"
else
GH_TOKEN="$token" gh issue edit "$NUMBER" --repo "$repo" --body "$BODY"
fi
}
# TechEngine: default token has issues:write on this repo.
sync_issue "${{ github.repository }}" "$SELF_TOKEN" \
|| echo "::warning::TechEngine coverage issue sync failed"
# TechAPI: best-effort — requires Issues:write on TECHAPI_TOKEN.
sync_issue "GetTechAPI/TechAPI" "$TECHAPI_TOKEN" \
|| echo "::warning::TechAPI coverage issue sync failed — TECHAPI_TOKEN likely lacks Issues:write"