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,12 @@
import logger from './logger.mjs';
export async function createComment(repo, issueId, body) {
return repo.issues(issueId).comments.create({ body });
}
export async function deleteComment(repo, commentId) {
return repo.issues.comments(commentId).remove();
const res = await repo.issues.comments(commentId).remove();
if (res) logger.debug(`Comment ${commentId} deleted`);
else logger.error(new Error(`Failed to remove comment ${commentId}`));
return res;
}