export const NOTIFICATION_CATEGORIES = [ "security_alert", "vulnerability_report", "ci", "ci_watching", "deploy", "quota", "runner", "import", "mergefix", "integration", ] as const; export type NotificationCategory = (typeof NOTIFICATION_CATEGORIES)[number]; export const DIGEST_MODES = ["off", "daily"] as const; export type DigestMode = (typeof DIGEST_MODES)[number]; export type CategoryInfo = { label: string; description: string; web: boolean; email: boolean; /** Noisy categories can be batched into a daily digest email instead of one email per event. */ digestable: boolean; }; export const CATEGORY_INFO: Record = { security_alert: { label: "Security alerts", description: "Secret scanning, push-protection bypasses and code scanning alerts in repositories you administer.", web: true, email: true, digestable: true, }, vulnerability_report: { label: "Vulnerability reports", description: "Private vulnerability reports and advisory updates you administer or reported.", web: true, email: true, digestable: false, }, ci: { label: "CI results", description: "Failed (and then fixed) workflow runs you triggered or that ran on your pull requests.", web: true, email: true, digestable: true, }, ci_watching: { label: "CI activity in watched repositories", description: "Failed and fixed workflow runs in repositories you watch.", web: false, email: false, digestable: true, }, deploy: { label: "Deployments", description: "Failed Sites deployments you pushed or administer.", web: true, email: true, digestable: true, }, quota: { label: "Usage and quotas", description: "Storage, bandwidth, metering quota and budget thresholds for accounts you own or bill.", web: true, email: true, digestable: false, }, runner: { label: "Runners", description: "Self-hosted runners you administer going offline.", web: true, email: true, digestable: true, }, import: { label: "Imports and forks", description: "Repository imports and forks you started that failed.", web: true, email: true, digestable: false, }, mergefix: { label: "Merge fixes", description: "Results of AI merge-conflict fixes you started.", web: true, email: false, digestable: true, }, integration: { label: "Integrations", description: "Integration deliveries and import jobs that gave up after repeated failures.", web: true, email: true, digestable: true, }, }; export function isNotificationCategory(value: string): value is NotificationCategory { return NOTIFICATION_CATEGORIES.some((category) => category === value); }