Skip to content

Commit

Permalink
This PR adds node-version to the action output.
Browse files Browse the repository at this point in the history
  • Loading branch information
panva committed Jun 30, 2022
1 parent 7d610f0 commit 3ac35da
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ inputs:
outputs:
cache-hit:
description: 'A boolean value to indicate if a cache was hit.'
node-version:
description: 'The installed node version.'
runs:
using: 'node16'
main: 'dist/setup/index.js'
Expand Down
12 changes: 12 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as core from '@actions/core';
import * as exec from '@actions/exec';
import * as installer from './installer';
import fs from 'fs';
import * as auth from './authutil';
Expand Down Expand Up @@ -39,6 +40,17 @@ export async function run() {
await installer.getNode(version, stable, checkLatest, auth, arch);
}

// Output version of node is 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) {
Expand Down

0 comments on commit 3ac35da

Please sign in to comment.