mirror of
https://github.com/actions/setup-node.git
synced 2025-12-16 01:51:49 +08:00
Format code and add try/catch blocks
This commit is contained in:
23
src/main.ts
23
src/main.ts
@@ -100,7 +100,7 @@ function resolveVersionInput(): string {
|
||||
}
|
||||
|
||||
async function printEnvDetailsAndSetOutput() {
|
||||
core.startGroup("Environment details");
|
||||
core.startGroup('Environment details');
|
||||
// Output version of node is being used
|
||||
try {
|
||||
const {stdout: installedNodeVersion} = await exec.getExecOutput(
|
||||
@@ -112,14 +112,21 @@ async function printEnvDetailsAndSetOutput() {
|
||||
} catch (err) {
|
||||
core.setOutput('node-version', '');
|
||||
}
|
||||
try {
|
||||
await exec.getExecOutput('npm', ['--version'], {
|
||||
ignoreReturnCode: true
|
||||
});
|
||||
} catch {
|
||||
core.warning('please check if npm is installed');
|
||||
}
|
||||
|
||||
await exec.getExecOutput('npm', ['--version'], {
|
||||
ignoreReturnCode: true
|
||||
});
|
||||
|
||||
await exec.getExecOutput('yarn', ['--version'], {
|
||||
ignoreReturnCode: true
|
||||
});
|
||||
try {
|
||||
await exec.getExecOutput('yarn', ['--version'], {
|
||||
ignoreReturnCode: true
|
||||
});
|
||||
} catch {
|
||||
core.warning('please check if yarn is installed');
|
||||
}
|
||||
|
||||
core.endGroup();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user