Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15199,11 +15199,16 @@ var __importStar = (this && this.__importStar) || function (mod) {
result["default"] = mod;
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const core = __importStar(__webpack_require__(470));
const io = __importStar(__webpack_require__(1));
const installer = __importStar(__webpack_require__(749));
const auth = __importStar(__webpack_require__(202));
const path = __importStar(__webpack_require__(622));
const child_process_1 = __importDefault(__webpack_require__(129));
function run() {
return __awaiter(this, void 0, void 0, function* () {
try {
Expand All @@ -15218,6 +15223,13 @@ function run() {
if (version) {
yield installer.getNode(version);
}
// Output version of node and npm that are being used
const nodePath = yield io.which('node');
const nodeVersion = child_process_1.default.execSync(`${nodePath} --version`);
console.log(`Node Version: ${nodeVersion}`);
const npmPath = yield io.which('npm');
const npmVersion = child_process_1.default.execSync(`${npmPath} --version`);
console.log(`npm Version: ${npmVersion}`);
const registryUrl = core.getInput('registry-url');
const alwaysAuth = core.getInput('always-auth');
if (registryUrl) {
Expand Down
11 changes: 11 additions & 0 deletions src/setup-node.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import * as core from '@actions/core';
import * as io from '@actions/io';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this unused @joshmgross?

import * as installer from './installer';
import * as auth from './authutil';
import * as path from 'path';
import cp from 'child_process';

async function run() {
try {
Expand All @@ -17,6 +19,15 @@ async function run() {
await installer.getNode(version);
}

// Output version of node and npm that are being used
const nodePath = await io.which('node');
const nodeVersion = cp.execSync(`${nodePath} --version`);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't execSync return a buffer of bytes that you need toString() (safely)? See https://github.com/actions/setup-go/blob/master/src/main.ts#L56

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought template strings (ex ${nodePath} --version) already called .toString()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhh - yeah. I think you're right. Just e2e test

console.log(`Node Version: ${nodeVersion}`);

const npmPath = await io.which('npm');
const npmVersion = cp.execSync(`${npmPath} --version`);
console.log(`npm Version: ${npmVersion}`);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure why none of this would fail. On one hand I was thinking we should make all this best effort. But then I rethought that if this can't work, then the action didn't do it's job so it should fail. So I think it's fine how it is.


const registryUrl: string = core.getInput('registry-url');
const alwaysAuth: string = core.getInput('always-auth');
if (registryUrl) {
Expand Down