feat: track processed, comments

so they can be skipped in subsequent runs
This commit is contained in:
2018-10-23 15:35:58 -07:00
parent 9bf386a722
commit 31b55fc7c2

View File

@@ -31,11 +31,16 @@ async function ghActionBot() {
const comments = (await getComments(repo, { const comments = (await getComments(repo, {
body: new RegExp(COMMENT_BODY_REGEXP, COMMENT_BODY_REGEXP_FLAGS), body: new RegExp(COMMENT_BODY_REGEXP, COMMENT_BODY_REGEXP_FLAGS),
actor: COMMENT_ACTOR, actor: COMMENT_ACTOR,
})).filter(comment => !history.get(comment.id)); })).filter(comment => !history.get(comment.id)); // skip comments already processed
if (comments.length) logger.debug(`Found ${comments.length} comments to process`);
// read pull data // read pull data
const pulls = (await Promise.all( const pulls = (await Promise.all(
comments.map(async comment => { comments.map(async comment => {
// keep track of comments that have been processed
history.add(comment);
const pull = await getPull(repo, comment.number); const pull = await getPull(repo, comment.number);
if (pull.state !== 'open') { if (pull.state !== 'open') {