feat: track processed, comments
so they can be skipped in subsequent runs
This commit is contained in:
@@ -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') {
|
||||||
|
|||||||
Reference in New Issue
Block a user