feat(telegram): notify on Gitea issue creation
apps/web/src/lib/telegram.ts: server-side Telegram client + alertIssueCreated. createGithubIssueForInsight action fires the alert after issue is created (after audit log, before revalidate). Severity emoji + insight link + issue link. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,7 @@ import { auth } from "@/lib/auth";
|
||||
import { writeAudit } from "@/lib/audit";
|
||||
import { createIssue, buildIssueBody } from "@/lib/gitea";
|
||||
import { pipelineQueue } from "@/lib/queue";
|
||||
import { alertIssueCreated } from "@/lib/telegram";
|
||||
|
||||
const ALLOWED_STATUS = new Set([
|
||||
"new",
|
||||
@@ -161,9 +162,21 @@ export async function createGithubIssueForInsight(
|
||||
await writeAudit({
|
||||
endpoint: `/insights/${insightId}/github-issue`,
|
||||
method: "POST",
|
||||
requestPayload: { issueNumber: issue.number, repo: process.env[`GITHUB_REPO_${insight.projectKey.toUpperCase()}`] },
|
||||
requestPayload: { issueNumber: issue.number, repo: process.env[`GITEA_REPO_${insight.projectKey.toUpperCase()}`] },
|
||||
responseStatus: 200,
|
||||
});
|
||||
|
||||
// Telegram notification (fire-and-forget)
|
||||
void alertIssueCreated({
|
||||
insightId: insight.id,
|
||||
insightTitle: insight.title,
|
||||
severity: insight.severity,
|
||||
type: insight.type,
|
||||
issueNumber: issue.number,
|
||||
issueUrl: issue.html_url,
|
||||
panelUrl,
|
||||
});
|
||||
|
||||
revalidatePath("/insights");
|
||||
revalidatePath(`/insights/i/${insightId}`);
|
||||
return { url: issue.html_url, number: issue.number };
|
||||
|
||||
Reference in New Issue
Block a user