Skip to content

Commit e715d9a

Browse files
authored
Merge pull request #137 from actions/joshmgross/log-node-version
Log node and npm versions
2 parents 339aa41 + 46903d1 commit e715d9a

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

dist/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15201,6 +15201,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
1520115201
};
1520215202
Object.defineProperty(exports, "__esModule", { value: true });
1520315203
const core = __importStar(__webpack_require__(470));
15204+
const exec = __importStar(__webpack_require__(986));
1520415205
const installer = __importStar(__webpack_require__(749));
1520515206
const auth = __importStar(__webpack_require__(202));
1520615207
const path = __importStar(__webpack_require__(622));
@@ -15218,6 +15219,12 @@ function run() {
1521815219
if (version) {
1521915220
yield installer.getNode(version);
1522015221
}
15222+
// Output version of node and npm that are being used
15223+
yield exec.exec('node', ['--version']);
15224+
// Older versions of Node don't include npm, so don't let this call fail
15225+
yield exec.exec('npm', ['--version'], {
15226+
ignoreReturnCode: true
15227+
});
1522115228
const registryUrl = core.getInput('registry-url');
1522215229
const alwaysAuth = core.getInput('always-auth');
1522315230
if (registryUrl) {

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"license": "MIT",
2525
"dependencies": {
2626
"@actions/core": "^1.2.2",
27+
"@actions/exec": "^1.0.3",
2728
"@actions/github": "^1.1.0",
2829
"@actions/http-client": "^1.0.6",
2930
"@actions/io": "^1.0.2",

src/setup-node.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import * as core from '@actions/core';
2+
import * as exec from '@actions/exec';
3+
import * as io from '@actions/io';
24
import * as installer from './installer';
35
import * as auth from './authutil';
46
import * as path from 'path';
@@ -17,6 +19,14 @@ async function run() {
1719
await installer.getNode(version);
1820
}
1921

22+
// Output version of node and npm that are being used
23+
await exec.exec('node', ['--version']);
24+
25+
// Older versions of Node don't include npm, so don't let this call fail
26+
await exec.exec('npm', ['--version'], {
27+
ignoreReturnCode: true
28+
});
29+
2030
const registryUrl: string = core.getInput('registry-url');
2131
const alwaysAuth: string = core.getInput('always-auth');
2232
if (registryUrl) {

0 commit comments

Comments
 (0)