From 6e00d7639625814c10f86daf9e7cd2105d5c95a3 Mon Sep 17 00:00:00 2001 From: shimataro Date: Sun, 30 Oct 2022 19:32:56 +0900 Subject: [PATCH] move calling main to front --- lib/index.js | 16 ++++++++-------- src/main.ts | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) 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); - } -}