Skip to content

Commit bcdf752

Browse files
authored
Merge pull request #126 from GetTechAPI/chore/actions-rebuild
ci: run TechAPI automation as reusable workflows without personal tokens
2 parents 72a191c + dc31438 commit bcdf752

16 files changed

Lines changed: 216 additions & 506 deletions

‎.github/workflows/bump-techapi.yml‎

Lines changed: 0 additions & 59 deletions
This file was deleted.
Lines changed: 16 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
name: coverage-report
22

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).
55
on:
66
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
88
workflow_dispatch:
99

1010
permissions:
1111
contents: read
1212
issues: write
1313

14-
# Guard against a slow run overlapping the next day's scheduled run.
14+
# Guard against a slow run overlapping the next scheduled run.
1515
concurrency:
1616
group: coverage-report
1717
cancel-in-progress: false
@@ -45,42 +45,18 @@ jobs:
4545
name: coverage-report
4646
path: coverage-report.md
4747

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
5851
env:
59-
BOT_TOKEN: ${{ secrets.TECHENGINEBOT_TOKEN }}
60-
SELF_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61-
TECHAPI_TOKEN: ${{ secrets.TECHAPI_TOKEN }}
52+
GH_TOKEN: ${{ github.token }}
6253
run: |
63-
set -uo pipefail
54+
set -euo pipefail
6455
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

‎.github/workflows/dump-refresh.yml‎

Lines changed: 0 additions & 123 deletions
This file was deleted.

‎.github/workflows/notify-techapi.yml‎

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)