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
@@ -47,3 +47,5 @@ With `Group.forgeSources` (a list of `{ host, type, name? }` entries) the messag
|
||||
```
|
||||
|
||||
Each line is `{name} {emoji}{status}` plus the job duration when it has completed. Successful jobs are prefixed with `+` (green), failed/other finished jobs with `-` (red), and running/queued/pending jobs use a plain space (no color). The job name is clamped to 200 chars and the whole field to the platform field limit. Drivers without diff support (Telegram, Feishu) render the block as a single inline code span.
|
||||
|
||||
The `workflow_run` webhook payload itself carries no job list — only a `jobs_url`. The worker fetches the jobs from that URL (one GitHub API call per delivery, skipped when no route matches): authenticated with a GitHub App installation token when `GITHUB_APP_ID` / `GITHUB_PRIVATE_KEY` are configured, otherwise unauthenticated (public repositories only). The App therefore needs the **Actions: read** repository permission. If the fetch fails (missing permission, private repo without App creds, rate limit) the message simply omits the Jobs field.
|
||||
Reference in new issue
Block a user