Skip to content

Commit 7d6e34e

Browse files
committed
chore(ci): author auto-generated coverage issue as TechEngineBot when PAT set
A GitHub issue's author is the account behind the authenticating token (unlike a commit, it can't be set via git config), so the sticky coverage issue was authored by github-actions (TechEngine) and by the TECHAPI_TOKEN owner (TechAPI). Prefer a new TECHENGINEBOT_TOKEN secret for both posts so the automation issues are attributed to TechEngineBot, falling back to the existing GITHUB_TOKEN / TECHAPI_TOKEN when it is absent (safe to merge before the secret exists).
1 parent e17d3b7 commit 7d6e34e

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

.github/workflows/coverage-report.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,17 @@ jobs:
4747
path: coverage-report.md
4848

4949
# Sticky issue: keep one open issue with the well-known title per repo,
50-
# updating it in place. Posts to BOTH TechEngine (default GITHUB_TOKEN) and
51-
# TechAPI (TECHAPI_TOKEN). The TechAPI post is best-effort: it needs the PAT
52-
# to carry Issues:write, so a missing permission warns instead of failing.
50+
# updating it in place. Posts to BOTH TechEngine and TechAPI.
51+
#
52+
# Authorship: a GitHub issue's author is the account behind the *token*
53+
# (unlike a commit, it cannot be set via git config). To attribute the
54+
# auto-generated issues to TechEngineBot, set a TechEngineBot PAT with
55+
# Issues:write on both repos as the TECHENGINEBOT_TOKEN secret; the steps
56+
# below prefer it. Without it they fall back to the default GITHUB_TOKEN
57+
# (TechEngine, authored by github-actions) and TECHAPI_TOKEN (TechAPI).
5358
- name: Sync sticky coverage issue (TechEngine + TechAPI)
5459
env:
60+
BOT_TOKEN: ${{ secrets.TECHENGINEBOT_TOKEN }}
5561
SELF_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5662
TECHAPI_TOKEN: ${{ secrets.TECHAPI_TOKEN }}
5763
run: |
@@ -72,9 +78,10 @@ jobs:
7278
GH_TOKEN="$token" gh issue edit "$NUMBER" --repo "$repo" --body "$BODY"
7379
fi
7480
}
75-
# TechEngine: default token has issues:write on this repo.
76-
sync_issue "${{ github.repository }}" "$SELF_TOKEN" \
81+
# Prefer the TechEngineBot PAT (so the issue is authored by the bot);
82+
# fall back to the per-repo defaults when it is not configured.
83+
sync_issue "${{ github.repository }}" "${BOT_TOKEN:-$SELF_TOKEN}" \
7784
|| echo "::warning::TechEngine coverage issue sync failed"
78-
# TechAPI: best-effort — requires Issues:write on TECHAPI_TOKEN.
79-
sync_issue "GetTechAPI/TechAPI" "$TECHAPI_TOKEN" \
80-
|| echo "::warning::TechAPI coverage issue sync failed — TECHAPI_TOKEN likely lacks Issues:write"
85+
# TechAPI: best-effort — requires Issues:write on the chosen token.
86+
sync_issue "GetTechAPI/TechAPI" "${BOT_TOKEN:-$TECHAPI_TOKEN}" \
87+
|| echo "::warning::TechAPI coverage issue sync failed — token likely lacks Issues:write"

0 commit comments

Comments
 (0)