From 54af4c1320eee4b2c9c6d46b4bede3f593b1bc50 Mon Sep 17 00:00:00 2001 From: yutopp Date: Sun, 21 Jun 2020 13:16:10 +0900 Subject: [PATCH] fix: Wrap an entrypoint by async to handle exceptions correctly (#363) * fix: add return type Co-authored-by: Shohei Ueda <30958501+peaceiris@users.noreply.github.com> --- src/index.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/index.ts b/src/index.ts index 9b3ca7c..24a628b 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 (): Promise => { + try { + await main.run(); + } catch (e) { + core.setFailed(`Action failed with error ${e.message}`); + } +})();