-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Update spam detection to comment on and close issue #11435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
andyfeller
merged 3 commits into
trunk
from
andyfeller/11408-close-suspected-spam-issues
Aug 4, 2025
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,16 +9,17 @@ | |
|
|
||
| set -euo pipefail | ||
|
|
||
| # Determine absolute path to script directory based on where it is called from. | ||
| # This allows the script to be run from any directory. | ||
| SPAM_DIR="$(dirname "$(realpath "$0")")" | ||
|
|
||
| _issue_url="$1" | ||
| if [[ -z "$_issue_url" ]]; then | ||
| echo "error: issue URL is empty" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| _suspected_spam_label="suspected-spam" | ||
| _check_issue_script=".github/workflows/scripts/spam-detection/check-issue.sh" | ||
|
|
||
| _result="$($_check_issue_script "$_issue_url")" | ||
| _result="$("$SPAM_DIR/check-issue.sh" "$_issue_url")" | ||
|
|
||
| if [[ "$_result" == "PASS" ]]; then | ||
| echo "detected as not-spam: $_issue_url" | ||
|
|
@@ -27,6 +28,17 @@ fi | |
|
|
||
| echo "detected as spam: $_issue_url" | ||
|
|
||
| gh issue edit --add-label "$_suspected_spam_label" "$_issue_url" | ||
| cat << EOF | gh issue comment "$_issue_url" --body-file - | ||
| Thank you for taking the time to create this issue. | ||
|
|
||
| We've automatically reviewed this issue and suspect it as potentially inauthentic or spam-like content. As a result, we're closing this issue. | ||
|
|
||
| **If this was closed by mistake**, please don't hesitate to reach out to us by commenting on this issue with additional context. | ||
|
|
||
| We appreciate your understanding and apologize if this action was taken in error. Our automated systems help us manage the large volume of issues we receive, but we know they're not perfect. | ||
| EOF | ||
|
Comment on lines
+31
to
+39
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note: I'm not attached to the text, so all suggestions and improvements are welcome 🙇 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| gh issue edit --add-label "suspected-spam" --add-label "invalid" "$_issue_url" | ||
|
babakks marked this conversation as resolved.
|
||
| gh issue close --reason 'not planned' "$_issue_url" | ||
|
|
||
| echo "issue labelled as suspected spam" | ||
| echo "issue processed as suspected spam: commented, closed, and labeled" | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.