mirror of
https://github.com/actions/setup-node.git
synced 2025-07-05 09:03:46 +00:00
feat: add node-lts-codename output
This commit is contained in:
parent
16352bb09b
commit
c81dbb113a
3 changed files with 51 additions and 0 deletions
28
src/main.ts
28
src/main.ts
|
@ -115,6 +115,12 @@ export async function printEnvDetailsAndSetOutput() {
|
|||
core.info(`${tool}: ${output}`);
|
||||
});
|
||||
|
||||
promises.push(
|
||||
getLtsCodename().then(codename => {
|
||||
core.setOutput('node-lts-codename', codename);
|
||||
})
|
||||
);
|
||||
|
||||
await Promise.all(promises);
|
||||
|
||||
core.endGroup();
|
||||
|
@ -137,3 +143,25 @@ async function getToolVersion(tool: string, options: string[]) {
|
|||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
async function getLtsCodename() {
|
||||
try {
|
||||
const {stdout, stderr, exitCode} = await exec.getExecOutput(
|
||||
'node',
|
||||
["-p 'process.release.lts || process.exit(0)'"],
|
||||
{
|
||||
ignoreReturnCode: true,
|
||||
silent: true
|
||||
}
|
||||
);
|
||||
|
||||
if (exitCode > 0) {
|
||||
core.warning(`[warning]${stderr}`);
|
||||
return '';
|
||||
}
|
||||
|
||||
return stdout;
|
||||
} catch (err) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue