Skip to content

Commit 676f500

Browse files
feat(github-workflow): enrich healthcheck with notificationPreview (#10218) (#10416)
* feat(github-workflow): enrich healthcheck with notificationPreview (#10218) * fix(github-workflow): add reason=mention filter to notification preview (#10416) --------- Co-authored-by: tobiu <tobiasuhlig78@gmail.com>
1 parent 48269c3 commit 676f500

2 files changed

Lines changed: 45 additions & 0 deletions

File tree

ai/mcp/server/github-workflow/openapi.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,6 +1088,30 @@ components:
10881088
type: array
10891089
items:
10901090
type: string
1091+
notificationPreview:
1092+
type: object
1093+
description: A passive inbox preview of unread GitHub notifications. Present only if authenticated.
1094+
properties:
1095+
unreadCount:
1096+
type: integer
1097+
description: Total number of unread notifications.
1098+
example: 3
1099+
latest:
1100+
type: array
1101+
description: The 5 most recent unread notifications.
1102+
items:
1103+
type: object
1104+
properties:
1105+
id:
1106+
type: string
1107+
reason:
1108+
type: string
1109+
type:
1110+
type: string
1111+
title:
1112+
type: string
1113+
url:
1114+
type: string
10911115

10921116
Label:
10931117
type: object

ai/mcp/server/github-workflow/services/HealthService.mjs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,27 @@ class HealthService extends Base {
361361
payload.status = 'unhealthy';
362362
payload.githubCli.details.push(authCheck.error);
363363
logger.info('[HealthService] gh-status: unauthenticated');
364+
} else {
365+
// Step 3: Enrich with Notifications (Passive Inbox) if authenticated
366+
try {
367+
const { stdout } = await execAsync('gh api notifications');
368+
const notifications = JSON.parse(stdout);
369+
const mentions = notifications.filter(n => n.reason === 'mention');
370+
371+
payload.notificationPreview = {
372+
unreadCount: mentions.length,
373+
latest: mentions.slice(0, 5).map(n => ({
374+
id: n.id,
375+
reason: n.reason,
376+
type: n.subject?.type,
377+
title: n.subject?.title,
378+
url: n.subject?.url
379+
}))
380+
};
381+
} catch (e) {
382+
logger.warn(`[HealthService] Failed to fetch notifications for preview: ${e.message}`);
383+
// Don't fail the healthcheck if notifications fail, just omit the preview
384+
}
364385
}
365386

366387
// If we made it here with no issues, everything is healthy

0 commit comments

Comments
 (0)