|
1 | 1 | name: coverage-report |
2 | 2 |
|
3 | | -# Daily: pull upstream catalogs, diff vs the curated TechAPI dataset, post |
4 | | -# the gap list as a sticky issue (auto-updates the existing one each run). |
| 3 | +# Weekly: pull upstream catalogs, diff vs the curated TechAPI dataset, post |
| 4 | +# the gap list as a sticky issue in this repo (auto-updates the existing one). |
5 | 5 | on: |
6 | 6 | schedule: |
7 | | - - cron: "23 6 * * *" # Daily 06:23 UTC (reads curated data/, so safe to run every day) |
| 7 | + - cron: "23 6 * * 1" # Mondays 06:23 UTC |
8 | 8 | workflow_dispatch: |
9 | 9 |
|
10 | 10 | permissions: |
11 | 11 | contents: read |
12 | 12 | issues: write |
13 | 13 |
|
14 | | -# Guard against a slow run overlapping the next day's scheduled run. |
| 14 | +# Guard against a slow run overlapping the next scheduled run. |
15 | 15 | concurrency: |
16 | 16 | group: coverage-report |
17 | 17 | cancel-in-progress: false |
@@ -45,42 +45,18 @@ jobs: |
45 | 45 | name: coverage-report |
46 | 46 | path: coverage-report.md |
47 | 47 |
|
48 | | - # Sticky issue: keep one open issue with the well-known title per repo, |
49 | | - # updating it in place. Posts to BOTH TechEngine and TechAPI. |
50 | | - # |
51 | | - # Authorship: a GitHub issue's author is the account behind the *token* |
52 | | - # (unlike a commit, it cannot be set via git config). To attribute the |
53 | | - # auto-generated issues to TechEngineBot, set a TechEngineBot PAT with |
54 | | - # Issues:write on both repos as the TECHENGINEBOT_TOKEN secret; the steps |
55 | | - # below prefer it. Without it they fall back to the default GITHUB_TOKEN |
56 | | - # (TechEngine, authored by github-actions) and TECHAPI_TOKEN (TechAPI). |
57 | | - - name: Sync sticky coverage issue (TechEngine + TechAPI) |
| 48 | + # Sticky issue: keep one open issue with the well-known title, updating it |
| 49 | + # in place. Only this repo, with its own GITHUB_TOKEN (github-actions[bot]). |
| 50 | + - name: Sync sticky coverage issue |
58 | 51 | env: |
59 | | - BOT_TOKEN: ${{ secrets.TECHENGINEBOT_TOKEN }} |
60 | | - SELF_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
61 | | - TECHAPI_TOKEN: ${{ secrets.TECHAPI_TOKEN }} |
| 52 | + GH_TOKEN: ${{ github.token }} |
62 | 53 | run: | |
63 | | - set -uo pipefail |
| 54 | + set -euo pipefail |
64 | 55 | TITLE="Coverage gaps (auto-generated)" |
65 | | - BODY="$(cat coverage-report.md)" |
66 | | - sync_issue() { |
67 | | - repo="$1"; token="$2" |
68 | | - if [ -z "$token" ]; then |
69 | | - echo "::warning::no token for $repo; skipping coverage issue" |
70 | | - return 0 |
71 | | - fi |
72 | | - NUMBER=$(GH_TOKEN="$token" gh issue list --repo "$repo" --state open \ |
73 | | - --search "in:title \"$TITLE\"" --json number --jq '.[0].number // empty') || return 1 |
74 | | - if [ -z "${NUMBER:-}" ]; then |
75 | | - GH_TOKEN="$token" gh issue create --repo "$repo" --title "$TITLE" --body "$BODY" |
76 | | - else |
77 | | - GH_TOKEN="$token" gh issue edit "$NUMBER" --repo "$repo" --body "$BODY" |
78 | | - fi |
79 | | - } |
80 | | - # Prefer the TechEngineBot PAT (so the issue is authored by the bot); |
81 | | - # fall back to the per-repo defaults when it is not configured. |
82 | | - sync_issue "${{ github.repository }}" "${BOT_TOKEN:-$SELF_TOKEN}" \ |
83 | | - || echo "::warning::TechEngine coverage issue sync failed" |
84 | | - # TechAPI: best-effort — requires Issues:write on the chosen token. |
85 | | - sync_issue "GetTechAPI/TechAPI" "${BOT_TOKEN:-$TECHAPI_TOKEN}" \ |
86 | | - || echo "::warning::TechAPI coverage issue sync failed — token likely lacks Issues:write" |
| 56 | + NUMBER=$(gh issue list --repo "${{ github.repository }}" --state open \ |
| 57 | + --search "in:title \"$TITLE\"" --json number --jq '.[0].number // empty') |
| 58 | + if [ -z "${NUMBER:-}" ]; then |
| 59 | + gh issue create --repo "${{ github.repository }}" --title "$TITLE" --body-file coverage-report.md |
| 60 | + else |
| 61 | + gh issue edit "$NUMBER" --repo "${{ github.repository }}" --body-file coverage-report.md |
| 62 | + fi |
0 commit comments