koishi-plugin-githubsth 1.0.1-test1 → 1.0.1-test2

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.
@@ -22,9 +22,23 @@ class Notifier extends koishi_1.Service {
22
22
  this.ctx.on('github/pull_request_review', (payload) => this.handleEvent('pull_request_review', payload));
23
23
  }
24
24
  async handleEvent(event, payload) {
25
- const repoName = payload.repository?.full_name;
26
- if (!repoName)
25
+ let repoName = payload.repository?.full_name;
26
+ // Try to fallback if repoName is missing
27
+ if (!repoName && payload.issue?.repository_url) {
28
+ const parts = payload.issue.repository_url.split('/');
29
+ if (parts.length >= 2) {
30
+ repoName = `${parts[parts.length - 2]}/${parts[parts.length - 1]}`;
31
+ }
32
+ }
33
+ if (!repoName && payload.pull_request?.base?.repo?.full_name) {
34
+ repoName = payload.pull_request.base.repo.full_name;
35
+ }
36
+ if (!repoName) {
37
+ if (this.config.debug) {
38
+ this.ctx.logger('notifier').warn(`Event ${event} missing repository info. Keys: ${Object.keys(payload).join(', ')}`);
39
+ }
27
40
  return;
41
+ }
28
42
  if (this.config.debug) {
29
43
  this.ctx.logger('notifier').info(`Received event ${event} for ${repoName}`);
30
44
  this.ctx.logger('notifier').debug(JSON.stringify(payload, null, 2));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koishi-plugin-githubsth",
3
- "version": "1.0.1-test1",
3
+ "version": "1.0.1-test2",
4
4
  "description": "Github Subscriptions Notifications, push notifications for GitHub subscriptions For koishi",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -39,10 +39,11 @@
39
39
  },
40
40
  "service": {
41
41
  "required": [
42
- "database",
43
- "github"
42
+ "database"
44
43
  ],
45
- "optional": []
44
+ "optional": [
45
+ "github"
46
+ ]
46
47
  }
47
48
  }
48
49
  }