From 31b55fc7c2d7042e428a12f04124e1c4cd63fd28 Mon Sep 17 00:00:00 2001 From: joe fleming Date: Tue, 23 Oct 2018 15:35:58 -0700 Subject: [PATCH] feat: track processed, comments so they can be skipped in subsequent runs --- src/index.mjs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/index.mjs b/src/index.mjs index bec70c6..1b78af5 100644 --- a/src/index.mjs +++ b/src/index.mjs @@ -31,11 +31,16 @@ async function ghActionBot() { const comments = (await getComments(repo, { body: new RegExp(COMMENT_BODY_REGEXP, COMMENT_BODY_REGEXP_FLAGS), 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 const pulls = (await Promise.all( comments.map(async comment => { + // keep track of comments that have been processed + history.add(comment); + const pull = await getPull(repo, comment.number); if (pull.state !== 'open') {