diff --git a/lib/index.js b/lib/index.js index c2d8813..e57705c 100644 --- a/lib/index.js +++ b/lib/index.js @@ -586,6 +586,14 @@ __nccwpck_require__.r(__webpack_exports__); +try { + main(); +} +catch (err) { + if (err instanceof Error) { + _actions_core__WEBPACK_IMPORTED_MODULE_2__.setFailed(err); + } +} /** * main function */ @@ -727,14 +735,6 @@ function shouldCreateKeyFile(keyFilePath, ifKeyExists) { throw new Error(`SSH key is already installed. Set "if_key_exists" to "replace" or "ignore" in order to avoid this error.`); } } -try { - main(); -} -catch (err) { - if (err instanceof Error) { - _actions_core__WEBPACK_IMPORTED_MODULE_2__.setFailed(err); - } -} })(); diff --git a/src/main.ts b/src/main.ts index fef28f1..1dbc3df 100644 --- a/src/main.ts +++ b/src/main.ts @@ -9,6 +9,14 @@ interface FileInfo { options: fs.WriteFileOptions; } +try { + main(); +} catch (err) { + if (err instanceof Error) { + core.setFailed(err); + } +} + /** * main function */ @@ -167,11 +175,3 @@ function shouldCreateKeyFile(keyFilePath: string, ifKeyExists: string): boolean throw new Error(`SSH key is already installed. Set "if_key_exists" to "replace" or "ignore" in order to avoid this error.`); } } - -try { - main(); -} catch (err) { - if (err instanceof Error) { - core.setFailed(err); - } -}