Skip to content

Commit

Permalink
feat: ✨ Add CHROMEAPP input variable
Browse files Browse the repository at this point in the history
- add CHROMEAPP variable for Linux and MacOS Google Chrome binary name
  • Loading branch information
MickaelFontes committed Oct 30, 2024
1 parent 65de4e3 commit cd1684c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 5 additions & 2 deletions lib/setup-chromedriver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ JSON_URL=https://googlechromelabs.github.io/chrome-for-testing/known-good-versio

VERSION="${1:-}"
ARCH="${2:-linux64}"
CHROMEAPP="${3:-}"

sudo=$(command -v sudo)

if [[ "${ARCH}" =~ ^linux64 ]]; then
CHROMEAPP=google-chrome
if [[ -n "${CHROMEAPP}" ]]; then
CHROMEAPP=google-chrome
fi
APP="${CHROMEAPP}"
if command -v dpkg &>/dev/null; then
if ! dpkg -s "${APP}" >/dev/null; then
Expand All @@ -34,7 +37,7 @@ if [[ "${ARCH}" =~ ^linux64 ]]; then
fi
fi

if [[ "${ARCH}" =~ ^mac64 ]]; then
if [[ "${ARCH}" =~ ^mac64 && -n "${CHROMEAPP}" ]]; then
CHROMEAPP="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
fi

Expand Down
4 changes: 3 additions & 1 deletion src/setup-chromedriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ async function run() {
try {
console.log(`##setup chromedriver`);
const version = core.getInput("chromedriver-version", { required: false });
const chromeapp = core.getInput("chromeapp", { required: false });
const plat = process.platform;
let arch = "linux";
switch (plat) {
Expand All @@ -22,12 +23,13 @@ async function run() {
if (arch == "win32") {
await exec.exec(
"powershell -File " +
path.join(__dirname, "../lib", "setup-chromedriver.ps1 " + version)
path.join(__dirname, "../lib", "setup-chromedriver.ps1 " + version)
);
} else {
await exec.exec(path.join(__dirname, "../lib", "setup-chromedriver.sh"), [
version,
arch,
chromeapp
]);
}
} catch (error: unknown) {
Expand Down

0 comments on commit cd1684c

Please sign in to comment.