From b4d9c85eba9c9cb1aabecd56c3659c81cd820a06 Mon Sep 17 00:00:00 2001 From: yutopp Date: Sun, 21 Jun 2020 05:54:16 +0900 Subject: [PATCH] fix: Wrap an entrypoint by async to handle exceptions correctly --- src/index.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/index.ts b/src/index.ts index 9b3ca7c..86c2b9b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,8 +1,10 @@ import * as core from '@actions/core'; import * as main from './main'; -try { - main.run(); -} catch (e) { - core.setFailed(`Action failed with error ${e}`); -} +(async () => { + try { + await main.run(); + } catch (e) { + core.setFailed(`Action failed with error ${e}`); + } +})();