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>
This commit is contained in:
yutopp 2020-06-21 13:16:10 +09:00 committed by GitHub
parent 998d85162e
commit 54af4c1320
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 5 deletions

View File

@ -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<void> => {
try {
await main.run();
} catch (e) {
core.setFailed(`Action failed with error ${e.message}`);
}
})();