feat(github): fetch workflow_run jobs via jobs_url enrichment

The workflow_run webhook payload carries no jobs array, only jobs_url,
so the Jobs field never populated for real GitHub events. Fetch the job
list from the GitHub API once per delivery (lazy, memoized across
routes) and inject it into the payload before formatting.

- app-token.ts: shared getInstallationToken (App JWT -> installation
  token) + GITHUB_API_VERSION; check-run.ts now reuses it
- workflow-jobs.ts: getWorkflowRunJobs, App token when configured else
  unauthenticated (public repos), per_page=100, best-effort
- docs: GitHub App needs Actions: read; note API enrichment in the
  message-format and supported-events guides (en + zh)
This commit is contained in:
RhenCloud committed 2026-09-26 15:33:06 +08:00
1 parent ae36c22fda
commit 04352c3a19
12 files changed
+223 -23

No files matched your search

+3
View File
@@ -108,6 +108,9 @@ server/ # Nitro server
│ └── updates.ts # X-Lark-Signature verify + url_verification + /gh commands + card.action.trigger buttons
├── github/
│ ├── oauth.ts # OAuth URL, callback token exchange, getUserOctokit, comment/getComment/editComment/deleteComment/merge/close actions
│ ├── app-token.ts # createAppJwt-backed getInstallationToken + GITHUB_API_VERSION (shared App auth)
│ ├── check-run.ts # getCheckSuiteBuildLogUrl: Check-suite build-log enrichment (installation token)
│ ├── workflow-jobs.ts # getWorkflowRunJobs: fetch a workflow_run's jobs via jobs_url (App token or unauthenticated)
│ └── store.ts # KV token CRUD + D1 discord-link/telegram-link mapping (was token-store.ts)
├── web/ # HTTP UI/API logic (called from server/routes)
│ ├── oauth.ts # handleOAuthStart/Callback, install page + bind, personal-group self-signup