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

@@ -5,7 +5,7 @@ import getComments from './lib/get_comments.mjs';
import getPull from './lib/get_pull.mjs';
import getCommits from './lib/get_commits.mjs';
import getCommitStatus from './lib/get_commit_status.mjs';
import { createComment, deleteComment } from './lib/comments.mjs';
import createPullComment from './lib/create_pull_comment.mjs';
import History from './lib/history.mjs';
// load env vars from .env file
@@ -80,12 +80,9 @@ async function ghActionBot() {
}
await Promise.all(
records.map(async record => {
logger.log(`Re-testing PR #${record.pull.number}`);
const comment = await createComment(repo, records[0].pull.number, PULL_RETEST_BODY);
logger.debug(`Created comment id ${comment.id}`);
await deleteComment(repo, comment.id);
})
records.map(record =>
createPullComment(repo, record.pull.number, PULL_RETEST_BODY, { delete: true })
)
);
}