fix(ci): restore the undefined warningMessage in spam-detection workflow (#187)

The github-script step references warningMessage in createComment, but its
definition was removed in 9ac0c27 while the usage was kept. When a comment
tripped the threshold, the step threw 'ReferenceError: warningMessage is not
defined', which the surrounding try/catch swallowed — so the scam-warning
comment was never posted (only the label was applied). Restore the message,
built from the variables already in scope (author, foundPatterns,
suspiciousLinks).
This commit is contained in:
Recoordinate
2026-08-22 12:46:33 +02:00
committed by GitHub
parent 9ab74b91e0
commit b367191267
+5
View File
@@ -92,6 +92,11 @@ jobs:
// Trigger on either multiple patterns or high spam score // Trigger on either multiple patterns or high spam score
if (foundPatterns.length > 2 || spamScore >= 3) { if (foundPatterns.length > 2 || spamScore >= 3) {
const warningMessage =
`⚠️ Potential scam detected in comment by ${author}:\n` +
`- Suspicious patterns found: ${foundPatterns.join(', ')}\n` +
`${suspiciousLinks ? '- Contains external links\n' : ''}` +
`\n@${context.repo.owner} Please review this comment.`;
try { try {
// Create a warning comment // Create a warning comment
await github.rest.issues.createComment({ await github.rest.issues.createComment({