cloudflare/kumo
Publicmirrored fromhttps://github.com/cloudflare/kumoAvailable
ci/reporters/kumo-docs-preview.ts
32lines · modecode
| 1 | /** |
| 2 | * Kumo Docs Preview Reporter |
| 3 | * |
| 4 | * Reports the deployed kumo-docs preview URL. |
| 5 | */ |
| 6 | |
| 7 | import type { CIContext, ReportItem, Reporter } from "./types"; |
| 8 | |
| 9 | export const kumoDocsPreviewReporter: Reporter = { |
| 10 | id: "kumo-docs-preview", |
| 11 | name: "Kumo Docs Preview", |
| 12 | |
| 13 | async collect(context: CIContext): Promise<ReportItem | null> { |
| 14 | const { kumoDocsPreviewUrl, shortSha } = context; |
| 15 | |
| 16 | if (!kumoDocsPreviewUrl) { |
| 17 | return null; |
| 18 | } |
| 19 | |
| 20 | const content = `**Preview URL:** [${kumoDocsPreviewUrl}](${kumoDocsPreviewUrl}) |
| 21 | |
| 22 | This preview deployment (\`${shortSha}\`) contains the latest documentation changes from this MR.`; |
| 23 | |
| 24 | return { |
| 25 | id: "kumo-docs-preview", |
| 26 | title: "📚 Documentation Preview", |
| 27 | priority: 30, |
| 28 | content, |
| 29 | success: true, |
| 30 | }; |
| 31 | }, |
| 32 | }; |