mirror of
https://github.com/Elysola/WebHooker.git
synced 2026-11-21 01:23:40 +00:00
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:
12 files changed
+223
-23
No files matched your search
@@ -62,6 +62,8 @@ Any event type without a dedicated formatter falls through to the generic format
|
||||
|
||||
`workflow_run` and `check_run` events (queued → running → success/failure) are sent once and then **edited in place** for each subsequent phase instead of posting a new message. The original message's link preview, author, and field layout are preserved; only the status, conclusion emoji, duration, and title are refreshed. Supported on both Discord (`editMessage`) and Telegram (`editMessageText` / `editMessageCaption`). `check_run` tracks by check name + commit SHA (falling back to the run id), so providers that issue a new run id per phase — e.g. Cloudflare Pages — still edit the same message.
|
||||
|
||||
`workflow_run` messages also carry a colored **Jobs** breakdown. Because the webhook payload itself has no job list (only a `jobs_url`), the worker fetches it from the GitHub API — authenticated with a GitHub App installation token when `GITHUB_APP_ID` / `GITHUB_PRIVATE_KEY` are set, otherwise unauthenticated (public repositories). The App therefore needs the **Actions: read** repository permission.
|
||||
|
||||
## Filter Compatibility
|
||||
|
||||
See the [Filter Tutorial](../guide/filters) for a hands-on guide with worked examples.
|
||||
|
||||
Reference in new issue
Block a user