diff --git a/src/summary.ts b/src/summary.ts index 8cb6c4dd..75aa5d0f 100644 --- a/src/summary.ts +++ b/src/summary.ts @@ -119,6 +119,36 @@ ${pageStatuses ${endText}`; } + if (owner !== "uppload" && repo !== "uppload") { + let website = `https://${config.owner}.github.io/${config.repo}/`; + if (config["status-website"] && config["status-website"].cname) + website = `https://${config["status-website"].cname}`; + + // Remove Upptime logo and add heaading + readmeContent = readmeContent + .split("\n") + .map((line, index) => { + if (index === 0 && line.includes("https://upptime.js.org")) { + return `# [📈 Live Status](${website}): **🟩 All systems operational**`; + } + return line; + }) + .filter((line) => !line.startsWith("## [📈 Live Status]")) + .join("\n"); + + // Remove default documentation + const docsStartText = readmeContent.split("")[0]; + const docsEndText = readmeContent.split("")[1]; + if (readmeContent.includes("")) + readmeContent = `${docsStartText}[**Visit our status website →**](${website})${docsEndText}`; + + // Remove Koj logo + const logoStartText = readmeContent.split("")[0]; + const logoEndText = readmeContent.split("")[1]; + if (readmeContent.includes("")) + readmeContent = `${logoStartText}${logoEndText}`; + } + // Add live status line readmeContent = readmeContent .split("\n") @@ -136,21 +166,6 @@ ${pageStatuses }) .join("\n"); - if (owner !== "uppload" && repo !== "uppload") { - // Change logo - readmeContent = readmeContent - .split("\n") - .map((line, index) => { - if (index === 0 && line.includes("https://upptime.js.org")) { - if (config["status-website"] && config["status-website"].name) - return `# ${config["status-website"].name}`; - return `# ${config.owner}/${config.repo}`; - } - return line; - }) - .join("\n"); - } - const sha = ( await octokit.repos.getContent({ owner,