Skip to content

Commit 5a89e37

Browse files
authored
fix(workflow): chore duplicate comment ratelimit
1 parent c32a29f commit 5a89e37

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

.github/workflows/allcontributor_autocommentor_active_issue.yml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
name: Comment on Active "Add Profile" Issues
1+
name: Comment on Active Add Profile Issues
22

33
on:
44
workflow_dispatch:
55
schedule:
6-
- cron: '0 */3 * * *'
6+
- cron: '0 */6 * * *'
77

88
jobs:
99
comment-on-active-issues:
@@ -27,13 +27,27 @@ jobs:
2727
const issueCreator = issue.user.login;
2828
const commentMessage = `@all-contributors please add @${issueCreator} for review`;
2929
30-
await github.rest.issues.createComment({
30+
const { data: comments } = await github.rest.issues.listComments({
3131
owner: context.repo.owner,
3232
repo: context.repo.repo,
33-
issue_number: issue.number,
34-
body: commentMessage
33+
issue_number: issue.number
3534
});
3635
37-
console.log(`Commented on issue #${issue.number}`);
36+
const hasAllContributorsComment = comments.some(comment =>
37+
comment.body.includes('@all-contributors please add')
38+
);
39+
40+
if (!hasAllContributorsComment) {
41+
await github.rest.issues.createComment({
42+
owner: context.repo.owner,
43+
repo: context.repo.repo,
44+
issue_number: issue.number,
45+
body: commentMessage
46+
});
47+
48+
console.log(`Commented on issue #${issue.number}`);
49+
} else {
50+
console.log(`Skipped commenting on issue #${issue.number} - already has an all-contributors comment`);
51+
}
3852
}
3953
}

0 commit comments

Comments
 (0)