| 73 | } |
| 74 | |
| 75 | export async function printEnvDetailsAndSetOutput() { |
| 76 | core.startGroup('Environment details'); |
| 77 | const promises = ['node', 'npm', 'yarn'].map(async tool => { |
| 78 | const pathTool = await io.which(tool, false); |
| 79 | const output = pathTool ? await getToolVersion(tool, ['--version']) : ''; |
| 80 | |
| 81 | return {tool, output}; |
| 82 | }); |
| 83 | |
| 84 | const tools = await Promise.all(promises); |
| 85 | tools.forEach(({tool, output}) => { |
| 86 | if (tool === 'node') { |
| 87 | core.setOutput(`${tool}-version`, output); |
| 88 | } |
| 89 | core.info(`${tool}: ${output}`); |
| 90 | }); |
| 91 | |
| 92 | core.endGroup(); |
| 93 | } |
| 94 | |
| 95 | async function getToolVersion(tool: string, options: string[]) { |
| 96 | try { |