Skip to content

Commit

Permalink
Release for 6e97fca
Browse files Browse the repository at this point in the history
  • Loading branch information
ueokande committed Dec 31, 2020
1 parent 1235322 commit eb8b067
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: 'Install and setup a specific version of Geckodriver'
author: "Shin'ya Ueoka"
inputs:
geckodriver-version:
description: 'The Geckodriver version to install and use.'
description: 'The Geckodriver version to install and use. Examples: 0.28.0, latest.'

runs:
using: 'node12'
Expand Down
18 changes: 17 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5081,8 +5081,21 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
const core = __importStar(__webpack_require__(186));
const exec = __importStar(__webpack_require__(514));
const tc = __importStar(__webpack_require__(784));
const httpm = __importStar(__webpack_require__(925));
const platform_1 = __webpack_require__(999);
const InstallerFactory_1 = __importDefault(__webpack_require__(892));
const getLatestVersion = () => __awaiter(void 0, void 0, void 0, function* () {
const apiURL = `https://api.github.com/repos/mozilla/geckodriver/releases/latest`;
const http = new httpm.HttpClient("setup-geckodrive");
const resp = yield http.getJson(apiURL);
if (resp.statusCode !== httpm.HttpCodes.OK) {
throw new Error(`Failed to get latest version: server returns ${resp.statusCode}`);
}
if (resp.result === null) {
throw new Error("Failed to get latest version: server returns empty body");
}
return resp.result.tag_name.replace(/^v/, "");
});
const install = (version, platform) => __awaiter(void 0, void 0, void 0, function* () {
const toolPath = tc.find("geckodriver", version);
if (toolPath) {
Expand All @@ -5101,8 +5114,11 @@ const install = (version, platform) => __awaiter(void 0, void 0, void 0, functio
});
const run = () => __awaiter(void 0, void 0, void 0, function* () {
try {
const version = core.getInput("geckodriver-version") || "latest";
let version = core.getInput("geckodriver-version") || "latest";
const platform = platform_1.getPlatform();
if (version === "latest") {
version = yield getLatestVersion();
}
core.info(`Setup geckodriver ${version}`);
const toolPath = yield install(version, platform);
core.addPath(toolPath);
Expand Down

0 comments on commit eb8b067

Please sign in to comment.