Skip to content

Commit 6204669

Browse files
authored
Merge pull request #42 from parvninama/fix/linkbot-avoid-duplicate-comments
Fix: prevent duplicate missing-issue comments on PRs
2 parents 0869e9d + f18f5db commit 6204669

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

.github/scripts/bot-pr-missing-linked-issue.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
module.exports = async ({ github, context }) => {
2+
const LINKBOT_MARKER = '<!-- LinkBot Missing Issue -->';
3+
24
let prNumber;
35
try {
46
const isDryRun = process.env.DRY_RUN === 'true';
@@ -38,7 +40,7 @@ module.exports = async ({ github, context }) => {
3840
});
3941

4042
const alreadyCommented = comments.data.some(comment =>
41-
comment.body.includes("this is LinkBot")
43+
comment.body?.includes(LINKBOT_MARKER)
4244
);
4345

4446
if (alreadyCommented) {
@@ -47,7 +49,7 @@ module.exports = async ({ github, context }) => {
4749
}
4850

4951
if (!regex.test(body)) {
50-
const commentBody = [
52+
const commentBody = [ `${LINKBOT_MARKER}` +
5153
`Hi @${prData.user.login}, this is **LinkBot** 👋`,
5254
``,
5355
`Linking pull requests to issues helps us significantly with reviewing pull requests and keeping the repository healthy.`,

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
173173
- Enhance TopicInfo `__str__` method and tests with additional coverage, and update the format_key function in `key_format.py` to handle objects with a _to_proto method.
174174

175175
### Fixed
176+
- Prevent LinkBot from posting duplicate “missing linked issue” comments on pull requests.
176177
- Refined intermediate assignment guard to validate Beginner issue completion with improved logging and GraphQL-based counting. (#1424)
177178
- Improved filename-related error handling with clearer and more descriptive error messages.(#1413)
178179
- Good First Issue bot no longer posts `/assign` reminders for repository collaborators. (#1367)

0 commit comments

Comments
 (0)