diff --git a/src/constants.ts b/src/constants.ts index bd0826c..ecabe7b 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -2,7 +2,14 @@ import * as path from "path"; export const ACTION_DIR = path.join(__dirname, ".."); -export const PUPPETEER_ENV = { - PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: "1", - PUPPETEER_EXECUTABLE_PATH: "/usr/bin/google-chrome", -}; +export const PUPPETEER_ENV = (() => { + const skipChromeDownload = + !!process.env.PUPPETEER_SKIP_CHROMIUM_DOWNLOAD || + !!process.env.GITHUB_ACTIONS; + if (!skipChromeDownload) return {}; + return { + PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: "1", + PUPPETEER_EXECUTABLE_PATH: + process.env.PUPPETEER_EXECUTABLE_PATH || "/usr/bin/google-chrome", + }; +})();