koishi-plugin-github-webhook-pusher 0.0.6 → 0.0.8
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/lib/commands/index.d.ts +6 -0
- package/lib/commands/index.js +12 -0
- package/lib/commands/subscription.d.ts +12 -0
- package/lib/commands/subscription.js +214 -0
- package/lib/commands/trust.d.ts +10 -0
- package/lib/commands/trust.js +119 -0
- package/lib/commands/utils.d.ts +12 -0
- package/lib/commands/utils.js +182 -0
- package/lib/config.d.ts +20 -0
- package/lib/config.js +30 -0
- package/lib/database.d.ts +35 -0
- package/lib/database.js +39 -0
- package/lib/index.d.ts +18 -0
- package/lib/index.js +53 -0
- package/lib/message.d.ts +12 -0
- package/lib/message.js +250 -0
- package/lib/parser.d.ts +65 -0
- package/lib/parser.js +304 -0
- package/lib/pusher.d.ts +55 -0
- package/lib/pusher.js +128 -0
- package/lib/repository/delivery.d.ts +38 -0
- package/lib/repository/delivery.js +63 -0
- package/lib/repository/index.d.ts +6 -0
- package/lib/repository/index.js +22 -0
- package/lib/repository/subscription.d.ts +99 -0
- package/lib/repository/subscription.js +187 -0
- package/lib/repository/trust.d.ts +73 -0
- package/lib/repository/trust.js +133 -0
- package/lib/signature.d.ts +15 -0
- package/lib/signature.js +38 -0
- package/lib/types.d.ts +49 -0
- package/lib/types.js +40 -0
- package/lib/webhook.d.ts +21 -0
- package/lib/webhook.js +153 -0
- package/package.json +5 -2
package/lib/database.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extendDatabase = extendDatabase;
|
|
4
|
+
function extendDatabase(ctx) {
|
|
5
|
+
ctx.model.extend('github_trusted_repos', {
|
|
6
|
+
id: { type: 'unsigned', length: 10 },
|
|
7
|
+
repo: { type: 'string', length: 255 },
|
|
8
|
+
enabled: 'boolean',
|
|
9
|
+
createdAt: 'timestamp',
|
|
10
|
+
updatedAt: 'timestamp',
|
|
11
|
+
}, {
|
|
12
|
+
primary: 'id',
|
|
13
|
+
autoInc: true,
|
|
14
|
+
unique: ['repo'],
|
|
15
|
+
});
|
|
16
|
+
ctx.model.extend('github_subscriptions', {
|
|
17
|
+
id: { type: 'unsigned', length: 10 },
|
|
18
|
+
platform: 'string',
|
|
19
|
+
channelId: 'string',
|
|
20
|
+
guildId: 'string',
|
|
21
|
+
userId: 'string',
|
|
22
|
+
repo: 'string',
|
|
23
|
+
events: 'json',
|
|
24
|
+
enabled: 'boolean',
|
|
25
|
+
createdAt: 'timestamp',
|
|
26
|
+
updatedAt: 'timestamp',
|
|
27
|
+
}, {
|
|
28
|
+
primary: 'id',
|
|
29
|
+
autoInc: true,
|
|
30
|
+
});
|
|
31
|
+
ctx.model.extend('github_deliveries', {
|
|
32
|
+
deliveryId: 'string',
|
|
33
|
+
repo: 'string',
|
|
34
|
+
event: 'string',
|
|
35
|
+
receivedAt: 'timestamp',
|
|
36
|
+
}, {
|
|
37
|
+
primary: 'deliveryId',
|
|
38
|
+
});
|
|
39
|
+
}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
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;
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Koishi GitHub Webhook 推送插件入口
|
|
4
|
+
* 需求: 1.1, 7.1-7.7
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.Config = exports.inject = exports.name = void 0;
|
|
8
|
+
exports.apply = apply;
|
|
9
|
+
const koishi_1 = require("koishi");
|
|
10
|
+
const config_1 = require("./config");
|
|
11
|
+
Object.defineProperty(exports, "Config", { enumerable: true, get: function () { return config_1.Config; } });
|
|
12
|
+
const database_1 = require("./database");
|
|
13
|
+
const webhook_1 = require("./webhook");
|
|
14
|
+
const commands_1 = require("./commands");
|
|
15
|
+
/** 插件名称 */
|
|
16
|
+
exports.name = 'github-webhook-pusher';
|
|
17
|
+
/** 声明服务依赖 - 需要 server 服务提供 router 和 database 服务 */
|
|
18
|
+
exports.inject = ['server', 'database'];
|
|
19
|
+
/** 插件日志 */
|
|
20
|
+
const logger = new koishi_1.Logger('github-webhook-pusher');
|
|
21
|
+
/**
|
|
22
|
+
* 插件入口函数
|
|
23
|
+
* @param ctx Koishi 上下文
|
|
24
|
+
* @param config 插件配置
|
|
25
|
+
*/
|
|
26
|
+
function apply(ctx, config) {
|
|
27
|
+
// 需求 7.1-7.7: 使用配置项
|
|
28
|
+
logger.info(`正在加载 GitHub Webhook 插件...`);
|
|
29
|
+
// 初始化数据库
|
|
30
|
+
// 需求 6.1, 6.2, 6.3: 创建数据库表
|
|
31
|
+
(0, database_1.extendDatabase)(ctx);
|
|
32
|
+
logger.debug('数据库模型已注册');
|
|
33
|
+
// 需求 1.1: 注册 Webhook 处理器
|
|
34
|
+
(0, webhook_1.registerWebhook)(ctx, config);
|
|
35
|
+
logger.debug(`Webhook 处理器已注册: ${config.path}`);
|
|
36
|
+
// 注册所有命令
|
|
37
|
+
// 需求 2.1-2.5: 信任仓库管理命令
|
|
38
|
+
(0, commands_1.registerTrustCommands)(ctx);
|
|
39
|
+
logger.debug('信任仓库管理命令已注册');
|
|
40
|
+
// 需求 3.1-3.7: 订阅管理命令
|
|
41
|
+
(0, commands_1.registerSubscriptionCommands)(ctx, config);
|
|
42
|
+
logger.debug('订阅管理命令已注册');
|
|
43
|
+
// 需求 8.1, 8.2: 工具命令
|
|
44
|
+
(0, commands_1.registerUtilCommands)(ctx, config);
|
|
45
|
+
logger.debug('工具命令已注册');
|
|
46
|
+
// 插件启动日志
|
|
47
|
+
logger.info(`GitHub Webhook 插件已加载`);
|
|
48
|
+
logger.info(`Webhook 路径: ${config.path}`);
|
|
49
|
+
logger.info(`默认订阅事件: ${config.defaultEvents.join(', ')}`);
|
|
50
|
+
if (config.debug) {
|
|
51
|
+
logger.info('调试模式已启用');
|
|
52
|
+
}
|
|
53
|
+
}
|
package/lib/message.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 消息构建器
|
|
3
|
+
* 需求: 5.3, 5.4, 5.5
|
|
4
|
+
*/
|
|
5
|
+
import { Element } from 'koishi';
|
|
6
|
+
import { ParsedEvent } from './types';
|
|
7
|
+
/**
|
|
8
|
+
* 构建推送消息
|
|
9
|
+
* @param event 解析后的事件
|
|
10
|
+
* @returns Koishi Element 消息数组
|
|
11
|
+
*/
|
|
12
|
+
export declare function buildMessage(event: ParsedEvent): Element[];
|
package/lib/message.js
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* 消息构建器
|
|
4
|
+
* 需求: 5.3, 5.4, 5.5
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.buildMessage = buildMessage;
|
|
8
|
+
const koishi_1 = require("koishi");
|
|
9
|
+
const types_1 = require("./types");
|
|
10
|
+
/**
|
|
11
|
+
* 构建推送消息
|
|
12
|
+
* @param event 解析后的事件
|
|
13
|
+
* @returns Koishi Element 消息数组
|
|
14
|
+
*/
|
|
15
|
+
function buildMessage(event) {
|
|
16
|
+
switch (event.type) {
|
|
17
|
+
case 'issues':
|
|
18
|
+
return buildIssuesMessage(event);
|
|
19
|
+
case 'issue_comment':
|
|
20
|
+
return buildIssueCommentMessage(event);
|
|
21
|
+
case 'release':
|
|
22
|
+
return buildReleaseMessage(event);
|
|
23
|
+
case 'push':
|
|
24
|
+
return buildPushMessage(event);
|
|
25
|
+
case 'pull_request':
|
|
26
|
+
return buildPullRequestMessage(event);
|
|
27
|
+
case 'pull_request_review':
|
|
28
|
+
return buildPullRequestReviewMessage(event);
|
|
29
|
+
case 'pull_request_review_comment':
|
|
30
|
+
return buildPullRequestReviewCommentMessage(event);
|
|
31
|
+
case 'star':
|
|
32
|
+
return buildStarMessage(event);
|
|
33
|
+
case 'fork':
|
|
34
|
+
return buildForkMessage(event);
|
|
35
|
+
case 'create':
|
|
36
|
+
return buildCreateMessage(event);
|
|
37
|
+
case 'delete':
|
|
38
|
+
return buildDeleteMessage(event);
|
|
39
|
+
case 'workflow_run':
|
|
40
|
+
return buildWorkflowRunMessage(event);
|
|
41
|
+
default:
|
|
42
|
+
return buildGenericMessage(event);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* 构建 Issues 事件消息
|
|
47
|
+
* 格式: 📌 [owner/repo] Issue
|
|
48
|
+
* user opened #123: Issue Title
|
|
49
|
+
* https://github.com/...
|
|
50
|
+
*/
|
|
51
|
+
function buildIssuesMessage(event) {
|
|
52
|
+
const emoji = (0, types_1.getEventEmoji)(event.type);
|
|
53
|
+
const actionText = getActionText(event.action);
|
|
54
|
+
const lines = [
|
|
55
|
+
`${emoji} [${event.repo}] ${event.displayType}`,
|
|
56
|
+
`${event.actor} ${actionText} #${event.number}: ${event.title}`,
|
|
57
|
+
event.url,
|
|
58
|
+
];
|
|
59
|
+
return [(0, koishi_1.h)('text', { content: lines.join('\n') })];
|
|
60
|
+
}
|
|
61
|
+
function buildIssueCommentMessage(event) {
|
|
62
|
+
const emoji = (0, types_1.getEventEmoji)(event.type);
|
|
63
|
+
const actionText = getActionText(event.action);
|
|
64
|
+
const lines = [
|
|
65
|
+
`${emoji} [${event.repo}] ${event.displayType}`,
|
|
66
|
+
`${event.actor} ${actionText} #${event.number}: ${event.title}`,
|
|
67
|
+
event.url,
|
|
68
|
+
];
|
|
69
|
+
return [(0, koishi_1.h)('text', { content: lines.join('\n') })];
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* 构建 Release 事件消息
|
|
73
|
+
* 格式: 🚀 [owner/repo] Release
|
|
74
|
+
* user published v1.0.0
|
|
75
|
+
* https://github.com/...
|
|
76
|
+
*/
|
|
77
|
+
function buildReleaseMessage(event) {
|
|
78
|
+
const emoji = (0, types_1.getEventEmoji)(event.type);
|
|
79
|
+
const actionText = getActionText(event.action);
|
|
80
|
+
const lines = [
|
|
81
|
+
`${emoji} [${event.repo}] ${event.displayType}`,
|
|
82
|
+
`${event.actor} ${actionText} ${event.tagName || event.title}`,
|
|
83
|
+
event.url,
|
|
84
|
+
];
|
|
85
|
+
return [(0, koishi_1.h)('text', { content: lines.join('\n') })];
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* 构建 Push 事件消息
|
|
89
|
+
* 格式: ⬆️ [owner/repo] Commit
|
|
90
|
+
* user 推送了 3 个提交到 main
|
|
91
|
+
*
|
|
92
|
+
* • abc1234 - 提交消息1
|
|
93
|
+
* • def5678 - 提交消息2
|
|
94
|
+
* • ghi9012 - 提交消息3
|
|
95
|
+
*
|
|
96
|
+
* 还有 2 条提交...
|
|
97
|
+
* https://github.com/...
|
|
98
|
+
*/
|
|
99
|
+
function buildPushMessage(event) {
|
|
100
|
+
const emoji = (0, types_1.getEventEmoji)(event.type);
|
|
101
|
+
const commits = event.commits || [];
|
|
102
|
+
const totalCommits = event.totalCommits || commits.length;
|
|
103
|
+
const lines = [
|
|
104
|
+
`${emoji} [${event.repo}] ${event.displayType}`,
|
|
105
|
+
`${event.actor} 推送了 ${totalCommits} 个提交到 ${event.ref}`,
|
|
106
|
+
'',
|
|
107
|
+
];
|
|
108
|
+
// 添加提交列表
|
|
109
|
+
for (const commit of commits) {
|
|
110
|
+
lines.push(`• ${commit.sha} - ${commit.message}`);
|
|
111
|
+
}
|
|
112
|
+
// 如果有更多提交,显示提示
|
|
113
|
+
if (totalCommits > commits.length) {
|
|
114
|
+
lines.push('');
|
|
115
|
+
lines.push(`还有 ${totalCommits - commits.length} 条提交...`);
|
|
116
|
+
}
|
|
117
|
+
lines.push(event.url);
|
|
118
|
+
return [(0, koishi_1.h)('text', { content: lines.join('\n') })];
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* 构建 Pull Request 事件消息
|
|
122
|
+
* 格式: 🔀 [owner/repo] PR
|
|
123
|
+
* user opened #123: PR Title
|
|
124
|
+
* https://github.com/...
|
|
125
|
+
*/
|
|
126
|
+
function buildPullRequestMessage(event) {
|
|
127
|
+
const emoji = (0, types_1.getEventEmoji)(event.type);
|
|
128
|
+
const actionText = getActionText(event.action);
|
|
129
|
+
const lines = [
|
|
130
|
+
`${emoji} [${event.repo}] ${event.displayType}`,
|
|
131
|
+
`${event.actor} ${actionText} #${event.number}: ${event.title}`,
|
|
132
|
+
event.url,
|
|
133
|
+
];
|
|
134
|
+
return [(0, koishi_1.h)('text', { content: lines.join('\n') })];
|
|
135
|
+
}
|
|
136
|
+
function buildPullRequestReviewMessage(event) {
|
|
137
|
+
const emoji = (0, types_1.getEventEmoji)(event.type);
|
|
138
|
+
const actionText = getActionText(event.action);
|
|
139
|
+
const lines = [
|
|
140
|
+
`${emoji} [${event.repo}] ${event.displayType}`,
|
|
141
|
+
`${event.actor} ${actionText} #${event.number}: ${event.title}`,
|
|
142
|
+
event.url,
|
|
143
|
+
];
|
|
144
|
+
return [(0, koishi_1.h)('text', { content: lines.join('\n') })];
|
|
145
|
+
}
|
|
146
|
+
function buildPullRequestReviewCommentMessage(event) {
|
|
147
|
+
const emoji = (0, types_1.getEventEmoji)(event.type);
|
|
148
|
+
const actionText = getActionText(event.action);
|
|
149
|
+
const lines = [
|
|
150
|
+
`${emoji} [${event.repo}] ${event.displayType}`,
|
|
151
|
+
`${event.actor} ${actionText} #${event.number}: ${event.title}`,
|
|
152
|
+
event.url,
|
|
153
|
+
];
|
|
154
|
+
return [(0, koishi_1.h)('text', { content: lines.join('\n') })];
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* 构建 Star 事件消息
|
|
158
|
+
* 格式: ⭐ [owner/repo] Star
|
|
159
|
+
* user starred (⭐ 1234)
|
|
160
|
+
* https://github.com/...
|
|
161
|
+
*/
|
|
162
|
+
function buildStarMessage(event) {
|
|
163
|
+
const emoji = (0, types_1.getEventEmoji)(event.type);
|
|
164
|
+
const actionText = event.action === 'created' ? 'starred' : 'unstarred';
|
|
165
|
+
const lines = [
|
|
166
|
+
`${emoji} [${event.repo}] ${event.displayType}`,
|
|
167
|
+
`${event.actor} ${actionText} (⭐ ${event.starCount})`,
|
|
168
|
+
event.url,
|
|
169
|
+
];
|
|
170
|
+
return [(0, koishi_1.h)('text', { content: lines.join('\n') })];
|
|
171
|
+
}
|
|
172
|
+
function buildForkMessage(event) {
|
|
173
|
+
const emoji = (0, types_1.getEventEmoji)(event.type);
|
|
174
|
+
const target = event.title ? ` -> ${event.title}` : '';
|
|
175
|
+
const lines = [
|
|
176
|
+
`${emoji} [${event.repo}] ${event.displayType}`,
|
|
177
|
+
`${event.actor} forked${target}`,
|
|
178
|
+
event.url,
|
|
179
|
+
];
|
|
180
|
+
return [(0, koishi_1.h)('text', { content: lines.join('\n') })];
|
|
181
|
+
}
|
|
182
|
+
function buildCreateMessage(event) {
|
|
183
|
+
const emoji = (0, types_1.getEventEmoji)(event.type);
|
|
184
|
+
const actionText = getActionText(event.action);
|
|
185
|
+
const refText = event.ref ? ` ${event.ref}` : '';
|
|
186
|
+
const lines = [
|
|
187
|
+
`${emoji} [${event.repo}] ${event.displayType}`,
|
|
188
|
+
`${event.actor} ${actionText}${refText}`,
|
|
189
|
+
event.url,
|
|
190
|
+
];
|
|
191
|
+
return [(0, koishi_1.h)('text', { content: lines.join('\n') })];
|
|
192
|
+
}
|
|
193
|
+
function buildDeleteMessage(event) {
|
|
194
|
+
const emoji = (0, types_1.getEventEmoji)(event.type);
|
|
195
|
+
const actionText = getActionText(event.action);
|
|
196
|
+
const refText = event.ref ? ` ${event.ref}` : '';
|
|
197
|
+
const lines = [
|
|
198
|
+
`${emoji} [${event.repo}] ${event.displayType}`,
|
|
199
|
+
`${event.actor} ${actionText}${refText}`,
|
|
200
|
+
event.url,
|
|
201
|
+
];
|
|
202
|
+
return [(0, koishi_1.h)('text', { content: lines.join('\n') })];
|
|
203
|
+
}
|
|
204
|
+
function buildWorkflowRunMessage(event) {
|
|
205
|
+
const emoji = (0, types_1.getEventEmoji)(event.type);
|
|
206
|
+
const actionText = getActionText(event.action);
|
|
207
|
+
const nameText = event.title ? ` ${event.title}` : '';
|
|
208
|
+
const lines = [
|
|
209
|
+
`${emoji} [${event.repo}] ${event.displayType}`,
|
|
210
|
+
`${event.actor} ${actionText}${nameText}`,
|
|
211
|
+
event.url,
|
|
212
|
+
];
|
|
213
|
+
return [(0, koishi_1.h)('text', { content: lines.join('\n') })];
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* 构建通用事件消息(兜底)
|
|
217
|
+
*/
|
|
218
|
+
function buildGenericMessage(event) {
|
|
219
|
+
const emoji = (0, types_1.getEventEmoji)(event.type);
|
|
220
|
+
const lines = [
|
|
221
|
+
`${emoji} [${event.repo}] ${event.displayType}`,
|
|
222
|
+
`${event.actor} ${event.action || 'triggered'}`,
|
|
223
|
+
event.url,
|
|
224
|
+
];
|
|
225
|
+
return [(0, koishi_1.h)('text', { content: lines.join('\n') })];
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* 获取动作的中文描述
|
|
229
|
+
*/
|
|
230
|
+
function getActionText(action) {
|
|
231
|
+
const actionMap = {
|
|
232
|
+
opened: 'opened',
|
|
233
|
+
closed: 'closed',
|
|
234
|
+
reopened: 'reopened',
|
|
235
|
+
edited: 'edited',
|
|
236
|
+
merged: 'merged',
|
|
237
|
+
published: 'published',
|
|
238
|
+
created: 'created',
|
|
239
|
+
deleted: 'deleted',
|
|
240
|
+
submitted: 'submitted',
|
|
241
|
+
dismissed: 'dismissed',
|
|
242
|
+
approved: 'approved',
|
|
243
|
+
changes_requested: 'changes requested',
|
|
244
|
+
commented: 'commented',
|
|
245
|
+
requested: 'requested',
|
|
246
|
+
completed: 'completed',
|
|
247
|
+
forked: 'forked',
|
|
248
|
+
};
|
|
249
|
+
return actionMap[action || ''] || action || '';
|
|
250
|
+
}
|
package/lib/parser.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitHub Webhook 事件解析器
|
|
3
|
+
* 需求: 4.1-4.7
|
|
4
|
+
*/
|
|
5
|
+
import { ParsedEvent } from './types';
|
|
6
|
+
/**
|
|
7
|
+
* 解析 Issues 事件
|
|
8
|
+
* 需求 4.1: 提取 issue 标题、编号、操作者和链接
|
|
9
|
+
*/
|
|
10
|
+
export declare function parseIssuesEvent(payload: any): ParsedEvent | null;
|
|
11
|
+
/**
|
|
12
|
+
* 解析 Issue Comment 事件
|
|
13
|
+
*/
|
|
14
|
+
export declare function parseIssueCommentEvent(payload: any): ParsedEvent | null;
|
|
15
|
+
/**
|
|
16
|
+
* 解析 Release 事件
|
|
17
|
+
* 需求 4.2: 提取版本号、发布者和下载链接
|
|
18
|
+
*/
|
|
19
|
+
export declare function parseReleaseEvent(payload: any): ParsedEvent | null;
|
|
20
|
+
/**
|
|
21
|
+
* 解析 Push 事件
|
|
22
|
+
* 需求 4.3, 4.6: 提取分支名、提交列表(最多5条)和推送者信息
|
|
23
|
+
*/
|
|
24
|
+
export declare function parsePushEvent(payload: any): ParsedEvent | null;
|
|
25
|
+
/**
|
|
26
|
+
* 解析 Pull Request 事件
|
|
27
|
+
* 需求 4.4: 提取 PR 标题、编号、操作者和链接
|
|
28
|
+
*/
|
|
29
|
+
export declare function parsePullRequestEvent(payload: any): ParsedEvent | null;
|
|
30
|
+
/**
|
|
31
|
+
* 解析 Pull Request Review 事件
|
|
32
|
+
*/
|
|
33
|
+
export declare function parsePullRequestReviewEvent(payload: any): ParsedEvent | null;
|
|
34
|
+
/**
|
|
35
|
+
* 解析 Pull Request Review Comment 事件
|
|
36
|
+
*/
|
|
37
|
+
export declare function parsePullRequestReviewCommentEvent(payload: any): ParsedEvent | null;
|
|
38
|
+
/**
|
|
39
|
+
* 解析 Star 事件
|
|
40
|
+
* 需求 4.5: 提取操作者和当前 star 数量
|
|
41
|
+
*/
|
|
42
|
+
export declare function parseStarEvent(payload: any): ParsedEvent | null;
|
|
43
|
+
/**
|
|
44
|
+
* 解析 Fork 事件
|
|
45
|
+
*/
|
|
46
|
+
export declare function parseForkEvent(payload: any): ParsedEvent | null;
|
|
47
|
+
/**
|
|
48
|
+
* 解析 Create 事件
|
|
49
|
+
*/
|
|
50
|
+
export declare function parseCreateEvent(payload: any): ParsedEvent | null;
|
|
51
|
+
/**
|
|
52
|
+
* 解析 Delete 事件
|
|
53
|
+
*/
|
|
54
|
+
export declare function parseDeleteEvent(payload: any): ParsedEvent | null;
|
|
55
|
+
/**
|
|
56
|
+
* 解析 Workflow Run 事件
|
|
57
|
+
*/
|
|
58
|
+
export declare function parseWorkflowRunEvent(payload: any): ParsedEvent | null;
|
|
59
|
+
/**
|
|
60
|
+
* 统一的事件解析入口函数
|
|
61
|
+
* @param eventName X-GitHub-Event 头的值
|
|
62
|
+
* @param payload 解析后的 JSON 负载
|
|
63
|
+
* @returns 解析后的事件数据,不支持的事件返回 null
|
|
64
|
+
*/
|
|
65
|
+
export declare function parseEvent(eventName: string, payload: any): ParsedEvent | null;
|