-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.ts
31 lines (26 loc) · 913 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import * as core from "@actions/core";
import { installer } from "./src/installer";
import path from "path";
async function run(): Promise<void> {
try {
const browser = core.getInput("browser");
const version = core.getInput("version") || "latest";
if (browser === "") {
core.setFailed("'browser' parameter is missing");
return;
}
core.info(`Setup ${browser} (${version})`);
const binPath = await installer(browser, version);
const installDir = path.dirname(binPath);
const binName = path.basename(binPath);
core.setOutput("binary", binName);
core.setOutput("path", path.join(installDir));
core.addPath(path.join(installDir));
core.info(`Successfully installed ${browser} version ${version}`);
} catch (error) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
core.setFailed(error.message);
}
}
run();