Skip to content

Commit d186ea2

Browse files
author
NullPointerException
committed
update issue_bot
1 parent 4e6598c commit d186ea2

1 file changed

Lines changed: 25 additions & 7 deletions

File tree

.github/workflows/issue_bot.yml

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ jobs:
5656
},
5757
body: JSON.stringify({
5858
issue_number: issueNumber,
59-
owner: "InfinityLoop1308",
60-
repo: "PipePipe"
59+
repo: "InfinityLoop1308/PipePipe"
6160
})
6261
});
6362
@@ -67,6 +66,26 @@ jobs:
6766
6867
const titleResult = await titleResponse.json();
6968
console.log(titleResult)
69+
70+
// Check for spam and close if detected
71+
if (titleResult.is_spam) {
72+
await github.rest.issues.createComment({
73+
owner: context.repo.owner,
74+
repo: context.repo.repo,
75+
issue_number: issueNumber,
76+
body: "Closing as suspected spam. If you believe this is a mistake, please revise your content and open a new issue."
77+
});
78+
79+
await github.rest.issues.update({
80+
owner: context.repo.owner,
81+
repo: context.repo.repo,
82+
issue_number: issueNumber,
83+
state: "closed",
84+
state_reason: "spam"
85+
});
86+
return; // Stop processing here
87+
}
88+
7089
const generatedTitle = titleResult.generated_result;
7190
7291
// Update title if different
@@ -86,9 +105,8 @@ jobs:
86105
'Content-Type': 'application/json',
87106
},
88107
body: JSON.stringify({
89-
title: generatedTitle,
90-
owner: "InfinityLoop1308",
91-
repo: "PipePipe"
108+
issue_link: `https://github.com/InfinityLoop1308/PipePipe/issues/${issueNumber}`,
109+
type: "all"
92110
})
93111
});
94112
@@ -109,12 +127,12 @@ jobs:
109127
body: "✅ No similar issues found. This appears to be a unique issue."
110128
});
111129
} else {
112-
const issueLinks = relatedIssues.map(num => `#${num}`).join(', ');
130+
const issueList = relatedIssues.map(num => `- #${num}`).join('\n');
113131
await github.rest.issues.createComment({
114132
owner: context.repo.owner,
115133
repo: context.repo.repo,
116134
issue_number: issueNumber,
117-
body: `🔍 Found related issues: ${issueLinks}\n\nPlease check these issues first before proceeding.`
135+
body: `🔍 Found related issues:\n${issueList}\n\nPlease check these issues first before proceeding.`
118136
});
119137
}
120138

0 commit comments

Comments
 (0)