From 0743c1215e539765cf4ea90a690ccdbab8a2cb55 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Tue, 20 Dec 2022 02:59:16 +0100 Subject: [PATCH] Add canary test --- .github/workflows/reportBrokenPlugins.yml | 14 ++++++++++++++ test/generateReport.ts | 10 ++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.github/workflows/reportBrokenPlugins.yml b/.github/workflows/reportBrokenPlugins.yml index 8511b42b..719eca75 100644 --- a/.github/workflows/reportBrokenPlugins.yml +++ b/.github/workflows/reportBrokenPlugins.yml @@ -41,3 +41,17 @@ jobs: env: DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }} DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} + + - name: Create Report (Canary) + timeout-minutes: 10 + if: success() || failure() # even run if previous one failed + run: | + export PATH="$PWD/node_modules/.bin:$PATH" + export CHROMIUM_BIN=$(which chromium-browser) + export USE_CANARY=true + + esbuild test/generateReport.ts > dist/report.mjs + node dist/report.mjs >> $GITHUB_STEP_SUMMARY + env: + DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }} + DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} diff --git a/test/generateReport.ts b/test/generateReport.ts index 57d4f96e..9483225f 100644 --- a/test/generateReport.ts +++ b/test/generateReport.ts @@ -31,13 +31,15 @@ for (const variable of ["DISCORD_TOKEN", "CHROMIUM_BIN"]) { } } +const CANARY = process.env.USE_CANARY === "true"; + const browser = await pup.launch({ headless: true, executablePath: process.env.CHROMIUM_BIN }); const page = await browser.newPage(); -await page.setUserAgent("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36"); +await page.setUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"); function maybeGetError(handle: JSHandle) { return (handle as JSHandle)?.getProperty("message") @@ -65,7 +67,7 @@ function toCodeBlock(s: string) { } async function printReport() { - console.log("# Vencord Report"); + console.log("# Vencord Report" + (CANARY ? " (Canary)" : "")); console.log(); console.log("## Bad Patches"); @@ -98,7 +100,7 @@ async function printReport() { }, body: JSON.stringify({ description: "Here's the latest Vencord Report!", - username: "Vencord Reporter", + username: "Vencord Reporter" + (CANARY ? " (Canary)" : ""), avatar_url: "https://cdn.discordapp.com/icons/1015060230222131221/f0204a918c6c9c9a43195997e97d8adf.webp", embeds: [ { @@ -271,4 +273,4 @@ await page.evaluateOnNewDocument(` ;(${runTime.toString()})(${JSON.stringify(process.env.DISCORD_TOKEN)}); `); -await page.goto("https://discord.com/login"); +await page.goto(CANARY ? "https://canary.discord.com/login" : "https://discord.com/login");