Files
lark-webhook-sender/README.md
T
2025-10-13 19:39:49 +08:00

35 lines
1.3 KiB
Markdown

# lark-webhook-sender
🤖 基于飞书 Webhook 实现仓库代码更新 | AI 摘要
![img.png](img.png)
![lark.jpg](lark.jpg)
> [飞书开放平台 - 服务端API - 事件概述](https://open.feishu.cn/document/server-docs/event-subscription-guide/overview)
```mermaid
sequenceDiagram
participant Gitea as Gitea 仓库
participant Service as 你的服务 (Java)
participant AISummary as AI摘要服务
participant Lark as 飞书机器人
Gitea->>Service: 1. Git push事件触发
Service->>Service: 2. 验证Gitea请求(必须!)
Service-->>Service: 2.1 检查 X-Gitea-Event: push
Service-->>Service: 2.2 用 SECRET 校验 signature (HMAC-SHA256)
alt 验证通过
Service->>Service: 3. 解析Gitea Payload
Service-->>Service: 3.1 示例:
Service-->>Service: { "ref": "main", "commits": [{"message": "feat: ..."}] }
Service->>AISummary: 4. 调用AI摘要服务
AISummary->>Service: 4.1 返回总结结果
Service->>Lark: 5. 发送飞书机器人通知
Lark->>Lark: 5.1 格式化:
Lark->>Lark: { "msg_type": "text", "content": "【代码更新】feat: ... [AI总结]" }
Service-->>Gitea: 6. 返回 HTTP 200
else 验证失败
Service-->>Gitea: 6. 返回 HTTP 401
end
```