Skip to content

Commit

Permalink
fix(chrome): force executable path
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielCousin committed Aug 3, 2023
1 parent f8d77f6 commit d7a3584
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 0 deletions.
27 changes: 27 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
},
"dependencies": {
"@actions/core": "^1.10.0",
"@actions/exec": "^1.1.1",
"puppeteer": "^21.0.0"
},
"devDependencies": {
Expand Down
4 changes: 4 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import { getInput, setFailed } from "@actions/core";
import puppeteer from "puppeteer";
import { wait } from "./utils/wait";
import { findChromePath } from "./utils/findChromePath";

async function run(): Promise<void> {
const chromePath = await findChromePath();

const browser = await puppeteer.launch({
headless: "new",
executablePath: chromePath,
});

const waitMsInput = getInput("wait-on-start");
Expand Down
12 changes: 12 additions & 0 deletions src/utils/findChromePath.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { getExecOutput } from "@actions/exec";
import { setFailed } from "@actions/core";

export async function findChromePath() {
const output = await getExecOutput("which", ["google-chrome"]);

if (output.exitCode === 0) {
return output.stdout.trim();
}

setFailed("Chrome path not found");
}

0 comments on commit d7a3584

Please sign in to comment.