chore: consolidate some code

This commit is contained in:
2018-10-25 13:18:58 -07:00
parent 2dffe6e3b6
commit c075f14939
5 changed files with 27 additions and 16 deletions

View File

@@ -1,7 +1,7 @@
import dotenv from 'dotenv';
import logger from './lib/logger.mjs';
import createRepo from './lib/create_repo.mjs';
import { createComment, deleteComment } from './lib/comments.mjs';
import createPullComment from './lib/create_pull_comment.mjs';
dotenv.config();
@@ -14,10 +14,7 @@ async function forceRetest() {
}
const repo = createRepo(ownerRepo);
const comment = await createComment(repo, prNumber, PULL_RETEST_BODY);
const res = await deleteComment(repo, comment.id);
if (res) logger.debug(`Comment ${comment.id} deleted`);
else logger.error(new Error(`Failed to remove comment ${comment.id}`));
await createPullComment(repo, prNumber, PULL_RETEST_BODY, { delete: true });
}
forceRetest().catch(err => logger.error(err));