From 3b4496864b0e9bd248e6d4ea12f2608dd41c0374 Mon Sep 17 00:00:00 2001 From: joe fleming Date: Mon, 22 Oct 2018 10:56:01 -0700 Subject: [PATCH] fix: add error handling code --- src/index.mjs | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/src/index.mjs b/src/index.mjs index f9e0aab..fd534d1 100644 --- a/src/index.mjs +++ b/src/index.mjs @@ -10,7 +10,7 @@ import History from './lib/history.mjs'; // load env vars from .env file dotenv.config(); -export default async function() { +async function ghActionBot() { // parse repo name from cli and create repo instance const repo = createRepo(process.argv.splice(2)[0]); const { @@ -64,19 +64,11 @@ export default async function() { await deleteComment(repo, comment.id); }) ); - - /* - - TODO: - - - [x] keep track of seen comment ids, only process new ones - - [x] check the pr's status and only retest if no longer "Pending" - - [x] add a retest comment - - POST /repos/:owner/:repo/issues/:number/comments - - [x] delete the retest comment - - [ ] delete the build comment - - [ ] delete ALL build failure comments - - DELETE /repos/:owner/:repo/issues/comments/:comment_id - - */ +} + +export default function() { + return ghActionBot().catch(err => { + console.error(err); + return process.exit(1); + }); }