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 @@ WebHooker 支持 28 种 GitHub webhook 事件类型,每种都有专用的格
|
||||
|
||||
`workflow_run` / `check_run` 事件(queued → running → success/failure)只发送一条消息,后续每个阶段会**原地编辑**该消息,而不是发送新消息。消息的链接预览、作者和字段布局保持不变,仅刷新状态、结论 emoji、耗时和标题。Discord(`editMessage`)和 Telegram(`editMessageText` / `editMessageCaption`)均支持。`check_run` 以 check 名 + commit SHA 追踪(回退到 run id),因此每个阶段都会换新 run id 的提供方(例如 Cloudflare Pages)仍会编辑同一条消息。
|
||||
|
||||
`workflow_run` 消息还会附带带颜色的 **Jobs** 明细。由于 webhook 载荷本身不含作业列表(只有 `jobs_url`),Worker 会从 GitHub API 拉取——配置了 `GITHUB_APP_ID` / `GITHUB_PRIVATE_KEY` 时用 GitHub App 安装令牌鉴权,否则匿名请求(公开仓库)。因此 App 需要 **Actions: read** 仓库权限。
|
||||
|
||||
## 过滤器兼容性
|
||||
|
||||
实操指南见[过滤器教程](../guide/filters),包含完整示例。
|
||||
|
||||
Reference in new issue
Block a user