mirror of
https://github.com/actions/setup-node.git
synced 2026-06-14 14:13:52 +08:00
Compare commits
1 Commits
408bb570d1
...
v4.0.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
60edb5dd54 |
@@ -2,7 +2,6 @@ import * as core from '@actions/core';
|
|||||||
import * as cache from '@actions/cache';
|
import * as cache from '@actions/cache';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as glob from '@actions/glob';
|
import * as glob from '@actions/glob';
|
||||||
import osm from 'os';
|
|
||||||
|
|
||||||
import * as utils from '../src/cache-utils';
|
import * as utils from '../src/cache-utils';
|
||||||
import {restoreCache} from '../src/cache-restore';
|
import {restoreCache} from '../src/cache-restore';
|
||||||
@@ -13,7 +12,6 @@ describe('cache-restore', () => {
|
|||||||
process.env.RUNNER_OS = 'Linux';
|
process.env.RUNNER_OS = 'Linux';
|
||||||
}
|
}
|
||||||
const platform = process.env.RUNNER_OS;
|
const platform = process.env.RUNNER_OS;
|
||||||
const arch = 'arm64';
|
|
||||||
const commonPath = '/some/random/path';
|
const commonPath = '/some/random/path';
|
||||||
const npmCachePath = `${commonPath}/npm`;
|
const npmCachePath = `${commonPath}/npm`;
|
||||||
const pnpmCachePath = `${commonPath}/pnpm`;
|
const pnpmCachePath = `${commonPath}/pnpm`;
|
||||||
@@ -54,7 +52,6 @@ describe('cache-restore', () => {
|
|||||||
let getCommandOutputSpy: jest.SpyInstance;
|
let getCommandOutputSpy: jest.SpyInstance;
|
||||||
let restoreCacheSpy: jest.SpyInstance;
|
let restoreCacheSpy: jest.SpyInstance;
|
||||||
let hashFilesSpy: jest.SpyInstance;
|
let hashFilesSpy: jest.SpyInstance;
|
||||||
let archSpy: jest.SpyInstance;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
// core
|
// core
|
||||||
@@ -105,10 +102,6 @@ describe('cache-restore', () => {
|
|||||||
|
|
||||||
// cache-utils
|
// cache-utils
|
||||||
getCommandOutputSpy = jest.spyOn(utils, 'getCommandOutput');
|
getCommandOutputSpy = jest.spyOn(utils, 'getCommandOutput');
|
||||||
|
|
||||||
// os
|
|
||||||
archSpy = jest.spyOn(osm, 'arch');
|
|
||||||
archSpy.mockImplementation(() => arch);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Validate provided package manager', () => {
|
describe('Validate provided package manager', () => {
|
||||||
@@ -142,7 +135,7 @@ describe('cache-restore', () => {
|
|||||||
await restoreCache(packageManager, '');
|
await restoreCache(packageManager, '');
|
||||||
expect(hashFilesSpy).toHaveBeenCalled();
|
expect(hashFilesSpy).toHaveBeenCalled();
|
||||||
expect(infoSpy).toHaveBeenCalledWith(
|
expect(infoSpy).toHaveBeenCalledWith(
|
||||||
`Cache restored from key: node-cache-${platform}-${arch}-${packageManager}-${fileHash}`
|
`Cache restored from key: node-cache-${platform}-${packageManager}-${fileHash}`
|
||||||
);
|
);
|
||||||
expect(infoSpy).not.toHaveBeenCalledWith(
|
expect(infoSpy).not.toHaveBeenCalledWith(
|
||||||
`${packageManager} cache is not found`
|
`${packageManager} cache is not found`
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import * as core from '@actions/core';
|
|||||||
import * as exec from '@actions/exec';
|
import * as exec from '@actions/exec';
|
||||||
import * as tc from '@actions/tool-cache';
|
import * as tc from '@actions/tool-cache';
|
||||||
import * as cache from '@actions/cache';
|
import * as cache from '@actions/cache';
|
||||||
|
import * as io from '@actions/io';
|
||||||
|
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
@@ -24,6 +25,10 @@ describe('main tests', () => {
|
|||||||
let startGroupSpy: jest.SpyInstance;
|
let startGroupSpy: jest.SpyInstance;
|
||||||
let endGroupSpy: jest.SpyInstance;
|
let endGroupSpy: jest.SpyInstance;
|
||||||
|
|
||||||
|
let whichSpy: jest.SpyInstance;
|
||||||
|
|
||||||
|
let existsSpy: jest.SpyInstance;
|
||||||
|
|
||||||
let getExecOutputSpy: jest.SpyInstance;
|
let getExecOutputSpy: jest.SpyInstance;
|
||||||
|
|
||||||
let getNodeVersionFromFileSpy: jest.SpyInstance;
|
let getNodeVersionFromFileSpy: jest.SpyInstance;
|
||||||
@@ -55,6 +60,8 @@ describe('main tests', () => {
|
|||||||
inSpy = jest.spyOn(core, 'getInput');
|
inSpy = jest.spyOn(core, 'getInput');
|
||||||
inSpy.mockImplementation(name => inputs[name]);
|
inSpy.mockImplementation(name => inputs[name]);
|
||||||
|
|
||||||
|
whichSpy = jest.spyOn(io, 'which');
|
||||||
|
|
||||||
getExecOutputSpy = jest.spyOn(exec, 'getExecOutput');
|
getExecOutputSpy = jest.spyOn(exec, 'getExecOutput');
|
||||||
|
|
||||||
findSpy = jest.spyOn(tc, 'find');
|
findSpy = jest.spyOn(tc, 'find');
|
||||||
@@ -140,6 +147,10 @@ describe('main tests', () => {
|
|||||||
return {stdout: obj[command], stderr: '', exitCode: 0};
|
return {stdout: obj[command], stderr: '', exitCode: 0};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
whichSpy.mockImplementation(cmd => {
|
||||||
|
return `some/${cmd}/path`;
|
||||||
|
});
|
||||||
|
|
||||||
await util.printEnvDetailsAndSetOutput();
|
await util.printEnvDetailsAndSetOutput();
|
||||||
|
|
||||||
expect(setOutputSpy).toHaveBeenCalledWith('node-version', obj['node']);
|
expect(setOutputSpy).toHaveBeenCalledWith('node-version', obj['node']);
|
||||||
|
|||||||
@@ -248,6 +248,9 @@ describe('setup-node', () => {
|
|||||||
const toolPath = path.normalize('/cache/node/12.16.2/x64');
|
const toolPath = path.normalize('/cache/node/12.16.2/x64');
|
||||||
exSpy.mockImplementation(async () => '/some/other/temp/path');
|
exSpy.mockImplementation(async () => '/some/other/temp/path');
|
||||||
cacheSpy.mockImplementation(async () => toolPath);
|
cacheSpy.mockImplementation(async () => toolPath);
|
||||||
|
whichSpy.mockImplementation(cmd => {
|
||||||
|
return `some/${cmd}/path`;
|
||||||
|
});
|
||||||
|
|
||||||
await main.run();
|
await main.run();
|
||||||
|
|
||||||
|
|||||||
4
dist/cache-save/index.js
vendored
4
dist/cache-save/index.js
vendored
@@ -83336,6 +83336,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||||||
exports.unique = exports.printEnvDetailsAndSetOutput = exports.getNodeVersionFromFile = void 0;
|
exports.unique = exports.printEnvDetailsAndSetOutput = exports.getNodeVersionFromFile = void 0;
|
||||||
const core = __importStar(__nccwpck_require__(2186));
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
const exec = __importStar(__nccwpck_require__(1514));
|
const exec = __importStar(__nccwpck_require__(1514));
|
||||||
|
const io = __importStar(__nccwpck_require__(7436));
|
||||||
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
||||||
const path_1 = __importDefault(__nccwpck_require__(1017));
|
const path_1 = __importDefault(__nccwpck_require__(1017));
|
||||||
function getNodeVersionFromFile(versionFilePath) {
|
function getNodeVersionFromFile(versionFilePath) {
|
||||||
@@ -83387,7 +83388,8 @@ function printEnvDetailsAndSetOutput() {
|
|||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
core.startGroup('Environment details');
|
core.startGroup('Environment details');
|
||||||
const promises = ['node', 'npm', 'yarn'].map((tool) => __awaiter(this, void 0, void 0, function* () {
|
const promises = ['node', 'npm', 'yarn'].map((tool) => __awaiter(this, void 0, void 0, function* () {
|
||||||
const output = yield getToolVersion(tool, ['--version']);
|
const pathTool = yield io.which(tool, false);
|
||||||
|
const output = pathTool ? yield getToolVersion(tool, ['--version']) : '';
|
||||||
return { tool, output };
|
return { tool, output };
|
||||||
}));
|
}));
|
||||||
const tools = yield Promise.all(promises);
|
const tools = yield Promise.all(promises);
|
||||||
|
|||||||
34
dist/setup/index.js
vendored
34
dist/setup/index.js
vendored
@@ -92559,7 +92559,6 @@ const core = __importStar(__nccwpck_require__(2186));
|
|||||||
const glob = __importStar(__nccwpck_require__(8090));
|
const glob = __importStar(__nccwpck_require__(8090));
|
||||||
const path_1 = __importDefault(__nccwpck_require__(1017));
|
const path_1 = __importDefault(__nccwpck_require__(1017));
|
||||||
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
||||||
const os_1 = __importDefault(__nccwpck_require__(2037));
|
|
||||||
const constants_1 = __nccwpck_require__(9042);
|
const constants_1 = __nccwpck_require__(9042);
|
||||||
const cache_utils_1 = __nccwpck_require__(1678);
|
const cache_utils_1 = __nccwpck_require__(1678);
|
||||||
const restoreCache = (packageManager, cacheDependencyPath) => __awaiter(void 0, void 0, void 0, function* () {
|
const restoreCache = (packageManager, cacheDependencyPath) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
@@ -92568,7 +92567,6 @@ const restoreCache = (packageManager, cacheDependencyPath) => __awaiter(void 0,
|
|||||||
throw new Error(`Caching for '${packageManager}' is not supported`);
|
throw new Error(`Caching for '${packageManager}' is not supported`);
|
||||||
}
|
}
|
||||||
const platform = process.env.RUNNER_OS;
|
const platform = process.env.RUNNER_OS;
|
||||||
const arch = os_1.default.arch();
|
|
||||||
const cachePaths = yield (0, cache_utils_1.getCacheDirectories)(packageManagerInfo, cacheDependencyPath);
|
const cachePaths = yield (0, cache_utils_1.getCacheDirectories)(packageManagerInfo, cacheDependencyPath);
|
||||||
core.saveState(constants_1.State.CachePaths, cachePaths);
|
core.saveState(constants_1.State.CachePaths, cachePaths);
|
||||||
const lockFilePath = cacheDependencyPath
|
const lockFilePath = cacheDependencyPath
|
||||||
@@ -92578,7 +92576,7 @@ const restoreCache = (packageManager, cacheDependencyPath) => __awaiter(void 0,
|
|||||||
if (!fileHash) {
|
if (!fileHash) {
|
||||||
throw new Error('Some specified paths were not resolved, unable to cache dependencies.');
|
throw new Error('Some specified paths were not resolved, unable to cache dependencies.');
|
||||||
}
|
}
|
||||||
const keyPrefix = `node-cache-${platform}-${arch}-${packageManager}`;
|
const keyPrefix = `node-cache-${platform}-${packageManager}`;
|
||||||
const primaryKey = `${keyPrefix}-${fileHash}`;
|
const primaryKey = `${keyPrefix}-${fileHash}`;
|
||||||
core.debug(`primary key is ${primaryKey}`);
|
core.debug(`primary key is ${primaryKey}`);
|
||||||
core.saveState(constants_1.State.CachePrimaryKey, primaryKey);
|
core.saveState(constants_1.State.CachePrimaryKey, primaryKey);
|
||||||
@@ -93112,7 +93110,11 @@ class BaseDistribution {
|
|||||||
const fileName = this.osPlat == 'win32'
|
const fileName = this.osPlat == 'win32'
|
||||||
? `node-v${version}-win-${osArch}`
|
? `node-v${version}-win-${osArch}`
|
||||||
: `node-v${version}-${this.osPlat}-${osArch}`;
|
: `node-v${version}-${this.osPlat}-${osArch}`;
|
||||||
const urlFileName = this.osPlat == 'win32' ? `${fileName}.7z` : `${fileName}.tar.gz`;
|
const urlFileName = this.osPlat == 'win32'
|
||||||
|
? this.nodeInfo.arch === 'arm64'
|
||||||
|
? `${fileName}.zip`
|
||||||
|
: `${fileName}.7z`
|
||||||
|
: `${fileName}.tar.gz`;
|
||||||
const initialUrl = this.getDistributionUrl();
|
const initialUrl = this.getDistributionUrl();
|
||||||
const url = `${initialUrl}/v${version}/${urlFileName}`;
|
const url = `${initialUrl}/v${version}/${urlFileName}`;
|
||||||
return {
|
return {
|
||||||
@@ -93196,10 +93198,23 @@ class BaseDistribution {
|
|||||||
let extPath;
|
let extPath;
|
||||||
info = info || {}; // satisfy compiler, never null when reaches here
|
info = info || {}; // satisfy compiler, never null when reaches here
|
||||||
if (this.osPlat == 'win32') {
|
if (this.osPlat == 'win32') {
|
||||||
|
const extension = this.nodeInfo.arch === 'arm64' ? '.zip' : '.7z';
|
||||||
|
// Rename archive to add extension because after downloading
|
||||||
|
// archive does not contain extension type and it leads to some issues
|
||||||
|
// on Windows runners without PowerShell Core.
|
||||||
|
//
|
||||||
|
// For default PowerShell Windows it should contain extension type to unpack it.
|
||||||
|
if (extension === '.zip') {
|
||||||
|
const renamedArchive = `${downloadPath}.zip`;
|
||||||
|
fs_1.default.renameSync(downloadPath, renamedArchive);
|
||||||
|
extPath = yield tc.extractZip(renamedArchive);
|
||||||
|
}
|
||||||
|
else {
|
||||||
const _7zPath = path.join(__dirname, '../..', 'externals', '7zr.exe');
|
const _7zPath = path.join(__dirname, '../..', 'externals', '7zr.exe');
|
||||||
extPath = yield tc.extract7z(downloadPath, undefined, _7zPath);
|
extPath = yield tc.extract7z(downloadPath, undefined, _7zPath);
|
||||||
|
}
|
||||||
// 7z extracts to folder matching file name
|
// 7z extracts to folder matching file name
|
||||||
const nestedPath = path.join(extPath, path.basename(info.fileName, '.7z'));
|
const nestedPath = path.join(extPath, path.basename(info.fileName, extension));
|
||||||
if (fs_1.default.existsSync(nestedPath)) {
|
if (fs_1.default.existsSync(nestedPath)) {
|
||||||
extPath = nestedPath;
|
extPath = nestedPath;
|
||||||
}
|
}
|
||||||
@@ -93231,7 +93246,12 @@ class BaseDistribution {
|
|||||||
dataFileName = `osx-${osArch}-tar`;
|
dataFileName = `osx-${osArch}-tar`;
|
||||||
break;
|
break;
|
||||||
case 'win32':
|
case 'win32':
|
||||||
|
if (this.nodeInfo.arch === 'arm64') {
|
||||||
|
dataFileName = `win-${osArch}-zip`;
|
||||||
|
}
|
||||||
|
else {
|
||||||
dataFileName = `win-${osArch}-exe`;
|
dataFileName = `win-${osArch}-exe`;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Error(`Unexpected OS '${this.osPlat}'`);
|
throw new Error(`Unexpected OS '${this.osPlat}'`);
|
||||||
@@ -93785,6 +93805,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||||||
exports.unique = exports.printEnvDetailsAndSetOutput = exports.getNodeVersionFromFile = void 0;
|
exports.unique = exports.printEnvDetailsAndSetOutput = exports.getNodeVersionFromFile = void 0;
|
||||||
const core = __importStar(__nccwpck_require__(2186));
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
const exec = __importStar(__nccwpck_require__(1514));
|
const exec = __importStar(__nccwpck_require__(1514));
|
||||||
|
const io = __importStar(__nccwpck_require__(7436));
|
||||||
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
||||||
const path_1 = __importDefault(__nccwpck_require__(1017));
|
const path_1 = __importDefault(__nccwpck_require__(1017));
|
||||||
function getNodeVersionFromFile(versionFilePath) {
|
function getNodeVersionFromFile(versionFilePath) {
|
||||||
@@ -93836,7 +93857,8 @@ function printEnvDetailsAndSetOutput() {
|
|||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
core.startGroup('Environment details');
|
core.startGroup('Environment details');
|
||||||
const promises = ['node', 'npm', 'yarn'].map((tool) => __awaiter(this, void 0, void 0, function* () {
|
const promises = ['node', 'npm', 'yarn'].map((tool) => __awaiter(this, void 0, void 0, function* () {
|
||||||
const output = yield getToolVersion(tool, ['--version']);
|
const pathTool = yield io.which(tool, false);
|
||||||
|
const output = pathTool ? yield getToolVersion(tool, ['--version']) : '';
|
||||||
return { tool, output };
|
return { tool, output };
|
||||||
}));
|
}));
|
||||||
const tools = yield Promise.all(promises);
|
const tools = yield Promise.all(promises);
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import * as core from '@actions/core';
|
|||||||
import * as glob from '@actions/glob';
|
import * as glob from '@actions/glob';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import os from 'os';
|
|
||||||
|
|
||||||
import {State} from './constants';
|
import {State} from './constants';
|
||||||
import {
|
import {
|
||||||
@@ -22,7 +21,6 @@ export const restoreCache = async (
|
|||||||
throw new Error(`Caching for '${packageManager}' is not supported`);
|
throw new Error(`Caching for '${packageManager}' is not supported`);
|
||||||
}
|
}
|
||||||
const platform = process.env.RUNNER_OS;
|
const platform = process.env.RUNNER_OS;
|
||||||
const arch = os.arch();
|
|
||||||
|
|
||||||
const cachePaths = await getCacheDirectories(
|
const cachePaths = await getCacheDirectories(
|
||||||
packageManagerInfo,
|
packageManagerInfo,
|
||||||
@@ -40,7 +38,7 @@ export const restoreCache = async (
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const keyPrefix = `node-cache-${platform}-${arch}-${packageManager}`;
|
const keyPrefix = `node-cache-${platform}-${packageManager}`;
|
||||||
const primaryKey = `${keyPrefix}-${fileHash}`;
|
const primaryKey = `${keyPrefix}-${fileHash}`;
|
||||||
core.debug(`primary key is ${primaryKey}`);
|
core.debug(`primary key is ${primaryKey}`);
|
||||||
|
|
||||||
|
|||||||
@@ -112,7 +112,11 @@ export default abstract class BaseDistribution {
|
|||||||
? `node-v${version}-win-${osArch}`
|
? `node-v${version}-win-${osArch}`
|
||||||
: `node-v${version}-${this.osPlat}-${osArch}`;
|
: `node-v${version}-${this.osPlat}-${osArch}`;
|
||||||
const urlFileName: string =
|
const urlFileName: string =
|
||||||
this.osPlat == 'win32' ? `${fileName}.7z` : `${fileName}.tar.gz`;
|
this.osPlat == 'win32'
|
||||||
|
? this.nodeInfo.arch === 'arm64'
|
||||||
|
? `${fileName}.zip`
|
||||||
|
: `${fileName}.7z`
|
||||||
|
: `${fileName}.tar.gz`;
|
||||||
const initialUrl = this.getDistributionUrl();
|
const initialUrl = this.getDistributionUrl();
|
||||||
const url = `${initialUrl}/v${version}/${urlFileName}`;
|
const url = `${initialUrl}/v${version}/${urlFileName}`;
|
||||||
|
|
||||||
@@ -215,12 +219,24 @@ export default abstract class BaseDistribution {
|
|||||||
let extPath: string;
|
let extPath: string;
|
||||||
info = info || ({} as INodeVersionInfo); // satisfy compiler, never null when reaches here
|
info = info || ({} as INodeVersionInfo); // satisfy compiler, never null when reaches here
|
||||||
if (this.osPlat == 'win32') {
|
if (this.osPlat == 'win32') {
|
||||||
|
const extension = this.nodeInfo.arch === 'arm64' ? '.zip' : '.7z';
|
||||||
|
// Rename archive to add extension because after downloading
|
||||||
|
// archive does not contain extension type and it leads to some issues
|
||||||
|
// on Windows runners without PowerShell Core.
|
||||||
|
//
|
||||||
|
// For default PowerShell Windows it should contain extension type to unpack it.
|
||||||
|
if (extension === '.zip') {
|
||||||
|
const renamedArchive = `${downloadPath}.zip`;
|
||||||
|
fs.renameSync(downloadPath, renamedArchive);
|
||||||
|
extPath = await tc.extractZip(renamedArchive);
|
||||||
|
} else {
|
||||||
const _7zPath = path.join(__dirname, '../..', 'externals', '7zr.exe');
|
const _7zPath = path.join(__dirname, '../..', 'externals', '7zr.exe');
|
||||||
extPath = await tc.extract7z(downloadPath, undefined, _7zPath);
|
extPath = await tc.extract7z(downloadPath, undefined, _7zPath);
|
||||||
|
}
|
||||||
// 7z extracts to folder matching file name
|
// 7z extracts to folder matching file name
|
||||||
const nestedPath = path.join(
|
const nestedPath = path.join(
|
||||||
extPath,
|
extPath,
|
||||||
path.basename(info.fileName, '.7z')
|
path.basename(info.fileName, extension)
|
||||||
);
|
);
|
||||||
if (fs.existsSync(nestedPath)) {
|
if (fs.existsSync(nestedPath)) {
|
||||||
extPath = nestedPath;
|
extPath = nestedPath;
|
||||||
@@ -260,7 +276,11 @@ export default abstract class BaseDistribution {
|
|||||||
dataFileName = `osx-${osArch}-tar`;
|
dataFileName = `osx-${osArch}-tar`;
|
||||||
break;
|
break;
|
||||||
case 'win32':
|
case 'win32':
|
||||||
|
if (this.nodeInfo.arch === 'arm64') {
|
||||||
|
dataFileName = `win-${osArch}-zip`;
|
||||||
|
} else {
|
||||||
dataFileName = `win-${osArch}-exe`;
|
dataFileName = `win-${osArch}-exe`;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Error(`Unexpected OS '${this.osPlat}'`);
|
throw new Error(`Unexpected OS '${this.osPlat}'`);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as exec from '@actions/exec';
|
import * as exec from '@actions/exec';
|
||||||
|
import * as io from '@actions/io';
|
||||||
|
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
@@ -61,9 +62,9 @@ export function getNodeVersionFromFile(versionFilePath: string): string | null {
|
|||||||
|
|
||||||
export async function printEnvDetailsAndSetOutput() {
|
export async function printEnvDetailsAndSetOutput() {
|
||||||
core.startGroup('Environment details');
|
core.startGroup('Environment details');
|
||||||
|
|
||||||
const promises = ['node', 'npm', 'yarn'].map(async tool => {
|
const promises = ['node', 'npm', 'yarn'].map(async tool => {
|
||||||
const output = await getToolVersion(tool, ['--version']);
|
const pathTool = await io.which(tool, false);
|
||||||
|
const output = pathTool ? await getToolVersion(tool, ['--version']) : '';
|
||||||
|
|
||||||
return {tool, output};
|
return {tool, output};
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user