diff --git a/.changeset/comment-moderation.md b/.changeset/comment-moderation.md new file mode 100644 index 000000000..9da54a679 --- /dev/null +++ b/.changeset/comment-moderation.md @@ -0,0 +1,5 @@ +--- +"@bradygaster/squad-cli": patch +--- + +Add automated comment spam protection using GitHub's official ai-moderator action diff --git a/.github/workflows/squad-comment-moderation.yml b/.github/workflows/squad-comment-moderation.yml new file mode 100644 index 000000000..ff22bb7c0 --- /dev/null +++ b/.github/workflows/squad-comment-moderation.yml @@ -0,0 +1,32 @@ +name: Comment Moderation + +on: + issues: + types: [opened] + issue_comment: + types: [created] + pull_request_review_comment: + types: [created] + +permissions: + issues: write + pull-requests: write + models: read + contents: read + +jobs: + moderate: + runs-on: ubuntu-latest + timeout-minutes: 5 + # Skip bot comments + if: github.event.sender.type != 'Bot' + steps: + - uses: actions/checkout@v4 + - uses: github/ai-moderator@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + spam-label: 'spam' + minimize-detected-comments: true + enable-spam-detection: true + enable-link-spam-detection: true + enable-ai-detection: false diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e3d7ee08d..a9b8aaf8e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -287,6 +287,14 @@ GitHub Actions runs on every push: All checks must pass before merge. +### Comment Moderation + +This repo uses [GitHub's official ai-moderator action](https://github.com/github/ai-moderator) to automatically detect and minimize spam comments on issues and PRs. The action catches spam, link spam, and other disruptive content — legitimate first-time contributors are not affected. Note: the moderation workflow does not block users; it only minimizes their comments and applies a `spam` label. + +If your comment is mistakenly hidden, reply to the thread or open a new issue and a maintainer will restore it promptly. + +> **Scope note:** This comment moderation workflow addresses #751. + ## Common Tasks ### Add a CLI Command