mirror of
https://github.com/Elysola/WebHooker.git
synced 2026-11-20 17:13:49 +00:00
feat(workflow): render workflow_run jobs as colored diff block
List each job on its own line with a status emoji and, for completed jobs, the duration. Discord colors the diff fence: '+' green for success, '-' red for other finished conclusions, plain for running/queued/pending. Telegram/Feishu collapse it to inline code. Sync AGENTS.md, README(s), docs guide and supported-events tables.
This commit is contained in:
9 files changed
+109
-12
No files matched your search
@@ -10,7 +10,7 @@ WebHooker supports 28 GitHub webhook event types, each with a dedicated formatte
|
||||
| `pull_request` | PR opened/closed/merged/edited | PR title, branch, diff stats, labels |
|
||||
| `issues` | Issue opened/closed/edited | Issue title, labels, assignees |
|
||||
| `issue_comment` | Comment on issue or PR | Comment body, issue reference |
|
||||
| `workflow_run` | CI/CD workflow phase updated | Workflow status, conclusion, duration; phases update a single message in place |
|
||||
| `workflow_run` | CI/CD workflow phase updated | Workflow status, conclusion, duration, colored per-job breakdown; phases update a single message in place |
|
||||
| `workflow_job` | CI job phase updated | Job name, status, conclusion, workflow |
|
||||
| `status` | Commit status updated | Commit status, context, state, commit link |
|
||||
| `deployment` | Deployment created | Environment, ref, task |
|
||||
|
||||
@@ -34,3 +34,16 @@ With `Group.forgeSources` (a list of `{ host, type, name? }` entries) the messag
|
||||
## In-Place Updates
|
||||
|
||||
`workflow_run` and `check_run` messages are sent once and edited in place as the run progresses (queued → running → success/failure) — no duplicate messages. Tracking uses KV `msg:*` with a stable `updateKey` per run: `workflow_run` keys on the workflow id, while `check_run` keys on the check name + commit SHA (falling back to the run id) so deployments that emit a fresh run id per phase — e.g. Cloudflare Pages — still edit the same message.
|
||||
|
||||
## Workflow Jobs
|
||||
|
||||
`workflow_run` messages include a **Jobs** field listing every job in the run as a colored diff code block (Discord):
|
||||
|
||||
```
|
||||
+ build ✅ success · 1m 23s
|
||||
deploy 🔄 running
|
||||
lint ⏳ queued
|
||||
- test ❌ failure · 0m 45s
|
||||
```
|
||||
|
||||
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.
|
||||
@@ -10,7 +10,7 @@ WebHooker 支持 28 种 GitHub webhook 事件类型,每种都有专用的格
|
||||
| `pull_request` | PR 打开/关闭/合并/编辑 | PR 标题、分支、差异统计、标签 |
|
||||
| `issues` | 议题打开/关闭/编辑 | 议题标题、标签、指派人 |
|
||||
| `issue_comment` | 议题或 PR 的评论 | 评论内容、议题引用 |
|
||||
| `workflow_run` | CI/CD 工作流阶段更新 | 工作流状态、结论、耗时;各阶段原地更新同一条消息 |
|
||||
| `workflow_run` | CI/CD 工作流阶段更新 | 工作流状态、结论、耗时、带颜色的逐作业明细;各阶段原地更新同一条消息 |
|
||||
| `workflow_job` | CI 作业阶段更新 | 作业名、状态、结论、工作流 |
|
||||
| `status` | 提交状态更新 | 提交状态、上下文、状态值、提交链接 |
|
||||
| `deployment` | 部署已创建 | 环境、引用、任务 |
|
||||
|
||||
@@ -34,3 +34,16 @@
|
||||
## 原地更新
|
||||
|
||||
`workflow_run` 与 `check_run` 消息只发送一次,随运行进度原地编辑(queued → running → success/failure),不会重复发消息。追踪使用 KV `msg:*` 与每次运行的稳定 `updateKey`:`workflow_run` 以 workflow id 为键,`check_run` 则以 check 名 + commit SHA 为键(回退到 run id),因此每个阶段都换新 run id 的部署(例如 Cloudflare Pages)仍会编辑同一条消息。
|
||||
|
||||
## Workflow 作业
|
||||
|
||||
`workflow_run` 消息包含一个 **Jobs** 字段,以带颜色的 diff 代码块列出该次运行的全部作业(Discord):
|
||||
|
||||
```
|
||||
+ build ✅ success · 1m 23s
|
||||
deploy 🔄 running
|
||||
lint ⏳ queued
|
||||
- test ❌ failure · 0m 45s
|
||||
```
|
||||
|
||||
每行格式为 `{作业名} {emoji}{状态}`,作业完成后追加耗时。成功的作业以 `+` 前缀(绿色),失败/其他已结束的作业以 `-` 前缀(红色),运行中/排队中/待定的作业使用普通空格(无颜色)。作业名截断至 200 字符,整个字段截断至平台字段上限。不支持 diff 的驱动(Telegram、飞书)会把该代码块渲染为单个行内代码片段。
|
||||
Reference in new issue
Block a user