From 439cc136998d879dd4ef9db9247b1c02156ea9f8 Mon Sep 17 00:00:00 2001 From: Filip Skokan Date: Fri, 17 Jul 2020 12:06:09 +0200 Subject: [PATCH 1/2] feat: set node-version action output closes #150 --- action.yml | 3 +++ dist/index.js | 11 +++++++++++ src/main.ts | 12 ++++++++++++ 3 files changed, 26 insertions(+) diff --git a/action.yml b/action.yml index e5b901fcc..332c58f38 100644 --- a/action.yml +++ b/action.yml @@ -23,6 +23,9 @@ inputs: version: description: 'Deprecated. Use node-version instead. Will not be supported after October 1, 2019' deprecationMessage: 'The version property will not be supported after October 1, 2019. Use node-version instead' +outputs: + node-version: + description: "The installed node version." runs: using: 'node12' main: 'dist/index.js' diff --git a/dist/index.js b/dist/index.js index 93c2d649e..38f3fcf81 100644 --- a/dist/index.js +++ b/dist/index.js @@ -4628,6 +4628,7 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", { value: true }); const core = __importStar(__webpack_require__(470)); +const exec = __importStar(__webpack_require__(986)); const installer = __importStar(__webpack_require__(749)); const auth = __importStar(__webpack_require__(202)); const path = __importStar(__webpack_require__(622)); @@ -4650,6 +4651,16 @@ function run() { const checkLatest = (core.getInput('check-latest') || 'false').toUpperCase() === 'TRUE'; yield installer.getNode(version, stable, checkLatest, auth); } + // Output version of node and npm that are being used + let installedVersion = ''; + yield exec.exec('node', ['--version'], { + listeners: { + stdout: data => { + installedVersion += data.toString(); + } + } + }); + core.setOutput('node-version', installedVersion); const registryUrl = core.getInput('registry-url'); const alwaysAuth = core.getInput('always-auth'); if (registryUrl) { diff --git a/src/main.ts b/src/main.ts index 328db0d26..6ec8e1d6f 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,4 +1,5 @@ import * as core from '@actions/core'; +import * as exec from '@actions/exec'; import * as installer from './installer'; import * as auth from './authutil'; import * as path from 'path'; @@ -24,6 +25,17 @@ export async function run() { await installer.getNode(version, stable, checkLatest, auth); } + // Output version of node and npm that are being used + let installedVersion = ''; + await exec.exec('node', ['--version'], { + listeners: { + stdout: data => { + installedVersion += data.toString(); + } + } + }); + core.setOutput('node-version', installedVersion); + const registryUrl: string = core.getInput('registry-url'); const alwaysAuth: string = core.getInput('always-auth'); if (registryUrl) { From 5c741a400988dc7886873b188be925616bc84eca Mon Sep 17 00:00:00 2001 From: Filip Skokan Date: Fri, 17 Jul 2020 12:58:14 +0200 Subject: [PATCH 2/2] fixup! feat: set node-version action output --- dist/index.js | 2 +- src/main.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index 38f3fcf81..72c865f74 100644 --- a/dist/index.js +++ b/dist/index.js @@ -4651,7 +4651,7 @@ function run() { const checkLatest = (core.getInput('check-latest') || 'false').toUpperCase() === 'TRUE'; yield installer.getNode(version, stable, checkLatest, auth); } - // Output version of node and npm that are being used + // Output version of node is being used let installedVersion = ''; yield exec.exec('node', ['--version'], { listeners: { diff --git a/src/main.ts b/src/main.ts index 6ec8e1d6f..e3bfaab20 100644 --- a/src/main.ts +++ b/src/main.ts @@ -25,7 +25,7 @@ export async function run() { await installer.getNode(version, stable, checkLatest, auth); } - // Output version of node and npm that are being used + // Output version of node is being used let installedVersion = ''; await exec.exec('node', ['--version'], { listeners: {