From 0dfdd4514380f0623b1625922a06f8815c231f88 Mon Sep 17 00:00:00 2001 From: Rushil Perera Date: Tue, 4 Jun 2024 08:40:56 -0400 Subject: [PATCH] ci: use git when running as an Action --- .github/workflows/main.yml | 1 + src/scripts/verifyEnv.ts | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 38d6844..83fb3db 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,6 +19,7 @@ jobs: run: bun src/scripts/verifyEnv.ts env: CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} + IS_CI: true - name: Deploy uses: cloudflare/wrangler-action@v3 with: diff --git a/src/scripts/verifyEnv.ts b/src/scripts/verifyEnv.ts index 59ad8fc..e8a68bc 100644 --- a/src/scripts/verifyEnv.ts +++ b/src/scripts/verifyEnv.ts @@ -30,7 +30,12 @@ await logStep("Comparing env.d.ts", async () => { return; } - spawn({ cmd: ["sl", "diff", "src/types/env.d.ts"], stdout: "inherit" }); + const isCI = process.env["IS_CI"] === "true"; + const vcsCommand = isCI ? "git" : "sl"; + spawn({ + cmd: [vcsCommand, "diff", "src/types/env.d.ts"], + stdout: "inherit", + }); // add 1 second to make sure spawn completes await sleep(1000); throw new Error("env.d.ts is out of date");