re-download if cached version is incorrect

This commit is contained in:
Ben Sterling 2022-07-11 18:42:06 +01:00
parent 5b949b50c3
commit c5f0b687c5
No known key found for this signature in database
GPG key ID: 4A6610DCFFC78977
3 changed files with 45 additions and 2 deletions

8
dist/setup/index.js vendored
View file

@ -71409,6 +71409,7 @@ const core = __importStar(__nccwpck_require__(2186));
const hc = __importStar(__nccwpck_require__(9925));
const io = __importStar(__nccwpck_require__(7436));
const tc = __importStar(__nccwpck_require__(7784));
const exec = __importStar(__nccwpck_require__(1514));
const path = __importStar(__nccwpck_require__(1017));
const semver = __importStar(__nccwpck_require__(5911));
const fs = __nccwpck_require__(7147);
@ -71447,8 +71448,13 @@ function getNode(versionSpec, stable, checkLatest, auth, arch = os.arch()) {
// If not found in cache, download
if (toolPath) {
core.info(`Found in cache @ ${toolPath}`);
const { stdout: installedVersion } = yield exec.getExecOutput('node', ['--version'], { ignoreReturnCode: true });
if (!semver.satisfies(installedVersion, versionSpec)) {
core.info(`Found ${installedVersion} in cache @ ${toolPath} but it does not satisfy the requested version (${versionSpec})`);
toolPath = '';
}
}
else {
if (!toolPath) {
core.info(`Attempting to download ${versionSpec}...`);
let downloadPath = '';
let info = null;