koishi-plugin-github-webhook-pusher 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/readme.md +25 -11
- package/lib/commands/index.d.ts +0 -6
- package/lib/commands/subscription.d.ts +0 -12
- package/lib/commands/trust.d.ts +0 -10
- package/lib/commands/utils.d.ts +0 -12
- package/lib/config.d.ts +0 -20
- package/lib/database.d.ts +0 -35
- package/lib/index.d.ts +0 -18
- package/lib/index.js +0 -1014
- package/lib/message.d.ts +0 -12
- package/lib/parser.d.ts +0 -37
- package/lib/pusher.d.ts +0 -55
- package/lib/repository/delivery.d.ts +0 -38
- package/lib/repository/index.d.ts +0 -6
- package/lib/repository/subscription.d.ts +0 -99
- package/lib/repository/trust.d.ts +0 -73
- package/lib/signature.d.ts +0 -15
- package/lib/types.d.ts +0 -49
- package/lib/webhook.d.ts +0 -21
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/koishi-plugin-github-webhook-pusher)
|
|
4
4
|
|
|
5
|
-
Koishi 机器人框架的 GitHub Webhook 推送插件,支持将 GitHub
|
|
5
|
+
Koishi 机器人框架的 GitHub Webhook 推送插件,支持将 GitHub 仓库事件推送到 QQ 群聊或私聊。
|
|
6
6
|
|
|
7
7
|
## 功能特性
|
|
8
8
|
|
|
9
9
|
- 🔐 **安全验证** - 支持 HMAC SHA256 签名验证,确保 Webhook 请求来源可信
|
|
10
10
|
- 📋 **信任仓库管理** - 管理员可控制哪些仓库的事件可以被处理
|
|
11
11
|
- 🔔 **灵活订阅** - 用户可自由订阅感兴趣的仓库和事件类型
|
|
12
|
-
- 📨 **多事件支持** - 支持 Issues、
|
|
12
|
+
- 📨 **多事件支持** - 支持 Issues、Issue Comment、Pull Request、Review、Release、Push、Star、Fork 等常用事件
|
|
13
13
|
- 🚀 **并发推送** - 支持并发推送到多个订阅目标,可配置并发数
|
|
14
14
|
- 💾 **数据持久化** - 订阅和信任仓库数据持久化存储
|
|
15
15
|
|
|
@@ -74,10 +74,17 @@ https://your-koishi-server.com/github/webhook
|
|
|
74
74
|
- **Secret**: 与插件配置中的 `secret` 保持一致
|
|
75
75
|
- **Which events would you like to trigger this webhook?**: 选择需要的事件
|
|
76
76
|
- Issues
|
|
77
|
+
- Issue comments
|
|
78
|
+
- Pull requests
|
|
79
|
+
- Pull request reviews
|
|
80
|
+
- Pull request review comments
|
|
77
81
|
- Releases
|
|
78
82
|
- Pushes
|
|
79
|
-
- Pull requests
|
|
80
83
|
- Stars (Watch)
|
|
84
|
+
- Forks
|
|
85
|
+
- Create
|
|
86
|
+
- Delete
|
|
87
|
+
- Workflow runs
|
|
81
88
|
4. 点击 **Add webhook** 保存
|
|
82
89
|
|
|
83
90
|
### 3. 验证配置
|
|
@@ -108,8 +115,9 @@ https://your-koishi-server.com/github/webhook
|
|
|
108
115
|
| `gh.sub <repo>` | 订阅仓库 | `gh.sub koishijs/koishi` |
|
|
109
116
|
| `gh.unsub <repo>` | 取消订阅 | `gh.unsub koishijs/koishi` |
|
|
110
117
|
| `gh.list` | 列出当前会话的所有订阅 | `gh.list` |
|
|
111
|
-
| `gh.events
|
|
112
|
-
| `gh.
|
|
118
|
+
| `gh.events [repo]` | 查看订阅的事件类型(无 repo 时列出所有可用事件) | `gh.events koishijs/koishi` |
|
|
119
|
+
| `gh.on <repo> [...events]` | 快捷启用订阅事件 | `gh.on koishijs/koishi issues pull_request` |
|
|
120
|
+
| `gh.off <repo> [...events]` | 快捷禁用订阅事件 | `gh.off koishijs/koishi issues pull_request` |
|
|
113
121
|
|
|
114
122
|
### 工具命令
|
|
115
123
|
|
|
@@ -123,10 +131,17 @@ https://your-koishi-server.com/github/webhook
|
|
|
123
131
|
| 事件类型 | 显示名称 | Emoji | 说明 |
|
|
124
132
|
|----------|----------|-------|------|
|
|
125
133
|
| `issues` | Issue | 📌 | Issue 的创建、关闭、重新打开、编辑 |
|
|
126
|
-
| `
|
|
127
|
-
| `push` | Commit | ⬆️ | 代码推送(最多显示 5 条提交) |
|
|
134
|
+
| `issue_comment` | Issue Comment | 💬 | Issue 评论的创建、编辑、删除 |
|
|
128
135
|
| `pull_request` | PR | 🔀 | Pull Request 的创建、关闭、合并 |
|
|
136
|
+
| `pull_request_review` | PR Review | 🧪 | PR Review 的提交、编辑、撤销 |
|
|
137
|
+
| `pull_request_review_comment` | PR Review Comment | 💬 | PR Review 评论的创建、编辑、删除 |
|
|
138
|
+
| `release` | Release | 🚀 | 版本发布 |
|
|
139
|
+
| `push` | Commit | ⬆️ | 代码推送(最多显示 3 条提交) |
|
|
129
140
|
| `star` | Star | ⭐ | Star 操作 |
|
|
141
|
+
| `fork` | Fork | 🍴 | Fork 操作 |
|
|
142
|
+
| `create` | Create | ✨ | 分支/标签创建 |
|
|
143
|
+
| `delete` | Delete | 🗑️ | 分支/标签删除 |
|
|
144
|
+
| `workflow_run` | Workflow | 🧩 | Workflow 运行 |
|
|
130
145
|
|
|
131
146
|
## 消息格式示例
|
|
132
147
|
|
|
@@ -178,10 +193,9 @@ https://github.com/owner/repo/releases/tag/v1.0.0
|
|
|
178
193
|
|
|
179
194
|
### Q: 如何修改订阅的事件类型?
|
|
180
195
|
|
|
181
|
-
**A:** 使用 `gh.
|
|
182
|
-
-
|
|
183
|
-
-
|
|
184
|
-
- 混合操作:`gh.events owner/repo +issues -star`
|
|
196
|
+
**A:** 使用 `gh.on` / `gh.off` 命令:
|
|
197
|
+
- 启用事件:`gh.on owner/repo issues release`
|
|
198
|
+
- 禁用事件:`gh.off owner/repo star push`
|
|
185
199
|
|
|
186
200
|
### Q: 如何查看当前订阅了哪些仓库?
|
|
187
201
|
|
package/lib/commands/index.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 订阅管理命令
|
|
3
|
-
* 需求: 3.1-3.7
|
|
4
|
-
*/
|
|
5
|
-
import { Context } from 'koishi';
|
|
6
|
-
import { Config } from '../config';
|
|
7
|
-
/**
|
|
8
|
-
* 注册订阅管理命令
|
|
9
|
-
* @param ctx Koishi 上下文
|
|
10
|
-
* @param config 插件配置
|
|
11
|
-
*/
|
|
12
|
-
export declare function registerSubscriptionCommands(ctx: Context, config: Config): void;
|
package/lib/commands/trust.d.ts
DELETED
package/lib/commands/utils.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 工具命令
|
|
3
|
-
* 需求: 8.1, 8.2
|
|
4
|
-
*/
|
|
5
|
-
import { Context } from 'koishi';
|
|
6
|
-
import { Config } from '../config';
|
|
7
|
-
/**
|
|
8
|
-
* 注册工具命令
|
|
9
|
-
* @param ctx Koishi 上下文
|
|
10
|
-
* @param config 插件配置
|
|
11
|
-
*/
|
|
12
|
-
export declare function registerUtilCommands(ctx: Context, config: Config): void;
|
package/lib/config.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Schema } from 'koishi';
|
|
2
|
-
import { EventType } from './types';
|
|
3
|
-
export { EventType };
|
|
4
|
-
export interface Config {
|
|
5
|
-
/** Webhook 接收路径 */
|
|
6
|
-
path: string;
|
|
7
|
-
/** GitHub Webhook Secret */
|
|
8
|
-
secret: string;
|
|
9
|
-
/** 显示用基础 URL */
|
|
10
|
-
baseUrl?: string;
|
|
11
|
-
/** 默认订阅事件 */
|
|
12
|
-
defaultEvents: EventType[];
|
|
13
|
-
/** 调试模式 */
|
|
14
|
-
debug: boolean;
|
|
15
|
-
/** 允许非信任仓库 */
|
|
16
|
-
allowUntrusted: boolean;
|
|
17
|
-
/** 推送并发数 */
|
|
18
|
-
concurrency: number;
|
|
19
|
-
}
|
|
20
|
-
export declare const Config: Schema<Config>;
|
package/lib/database.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Context } from 'koishi';
|
|
2
|
-
import { EventType } from './types';
|
|
3
|
-
declare module 'koishi' {
|
|
4
|
-
interface Tables {
|
|
5
|
-
github_trusted_repos: TrustedRepo;
|
|
6
|
-
github_subscriptions: Subscription;
|
|
7
|
-
github_deliveries: Delivery;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
export interface TrustedRepo {
|
|
11
|
-
id: number;
|
|
12
|
-
repo: string;
|
|
13
|
-
enabled: boolean;
|
|
14
|
-
createdAt: Date;
|
|
15
|
-
updatedAt: Date;
|
|
16
|
-
}
|
|
17
|
-
export interface Subscription {
|
|
18
|
-
id: number;
|
|
19
|
-
platform: string;
|
|
20
|
-
channelId: string;
|
|
21
|
-
guildId: string;
|
|
22
|
-
userId: string;
|
|
23
|
-
repo: string;
|
|
24
|
-
events: EventType[];
|
|
25
|
-
enabled: boolean;
|
|
26
|
-
createdAt: Date;
|
|
27
|
-
updatedAt: Date;
|
|
28
|
-
}
|
|
29
|
-
export interface Delivery {
|
|
30
|
-
deliveryId: string;
|
|
31
|
-
repo: string;
|
|
32
|
-
event: string;
|
|
33
|
-
receivedAt: Date;
|
|
34
|
-
}
|
|
35
|
-
export declare function extendDatabase(ctx: Context): void;
|
package/lib/index.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Koishi GitHub Webhook 推送插件入口
|
|
3
|
-
* 需求: 1.1, 7.1-7.7
|
|
4
|
-
*/
|
|
5
|
-
import { Context } from 'koishi';
|
|
6
|
-
import { Config } from './config';
|
|
7
|
-
/** 插件名称 */
|
|
8
|
-
export declare const name = "github-webhook-pusher";
|
|
9
|
-
/** 声明服务依赖 - 需要 server 服务提供 router 和 database 服务 */
|
|
10
|
-
export declare const inject: string[];
|
|
11
|
-
/** 导出配置 Schema */
|
|
12
|
-
export { Config };
|
|
13
|
-
/**
|
|
14
|
-
* 插件入口函数
|
|
15
|
-
* @param ctx Koishi 上下文
|
|
16
|
-
* @param config 插件配置
|
|
17
|
-
*/
|
|
18
|
-
export declare function apply(ctx: Context, config: Config): void;
|