{"id":30119714,"url":"https://github.com/github/ai-moderator","last_synced_at":"2025-08-10T12:35:20.698Z","repository":{"id":308638940,"uuid":"1025289330","full_name":"github/ai-moderator","owner":"github","description":"An AI-powered GitHub Action that detects and tags spam in your repository","archived":false,"fork":false,"pushed_at":"2025-08-07T01:45:02.000Z","size":4677,"stargazers_count":0,"open_issues_count":4,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-07T03:26:34.677Z","etag":null,"topics":["actions","ai","spam-detection","spam-prevention"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/github.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":"SECURITY.md","support":"SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-24T03:25:24.000Z","updated_at":"2025-08-07T01:42:02.000Z","dependencies_parsed_at":"2025-08-07T03:27:10.518Z","dependency_job_id":null,"html_url":"https://github.com/github/ai-moderator","commit_stats":null,"previous_names":["github/ai-moderator"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/github/ai-moderator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fai-moderator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fai-moderator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fai-moderator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fai-moderator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/github","download_url":"https://codeload.github.com/github/ai-moderator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fai-moderator/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269725730,"owners_count":24465367,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actions","ai","spam-detection","spam-prevention"],"created_at":"2025-08-10T12:35:20.050Z","updated_at":"2025-08-10T12:35:20.687Z","avatar_url":"https://github.com/github.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# AI Moderator\n\nAn AI-powered GitHub Action that automatically detects spam in issues and\ncomments using LLMs. Detected issues are tagged as spam and detected comments\nare (optionally) minimized.\n\nEach new issue and comment is passed through a series of prompts: by default\nchecking for link spam, regular spam, and AI-generated content, but you can\n[write your own custom prompt](#custom-prompts) if you've got more specific\nrequirements.\n\n## Usage\n\nAdd this action to your repository's workflow file (e.g.,\n`.github/workflows/moderator.yml`):\n\n```yaml\nname: AI Moderator\non:\n  issues:\n    types: [opened]\n  issue_comment:\n    types: [created]\n  pull_request_review_comment:\n    types: [created]\n\njobs:\n  spam-detection:\n    runs-on: ubuntu-latest\n    permissions:\n      issues: write\n      pull-requests: write\n      models: read\n      contents: read\n    steps:\n      - uses: actions/checkout@v4\n      - uses: github/ai-moderator\n        with:\n          token: ${{ secrets.GITHUB_TOKEN }}\n          spam-label: 'spam'\n          ai-label: 'ai-generated'\n          minimize-detected-comments: true\n          # Built-in prompt configuration (all enabled by default)\n          enable-spam-detection: true\n          enable-link-spam-detection: true\n          enable-ai-detection: true\n          # custom-prompt-path: '.github/prompts/my-custom.prompt.yml'  # Optional\n```\n\n### Configuration\n\n| Input                        | Description                                                                        | Default               | Required |\n| ---------------------------- | ---------------------------------------------------------------------------------- | --------------------- | -------- |\n| `token`                      | GitHub token with issues and pull-requests permissions                             | `${{ github.token }}` | No       |\n| `spam-label`                 | Label to add when generic spam is detected                                         | `spam`                | No       |\n| `ai-label`                   | Label to add when AI-generated content is detected                                 | `ai-generated`        | No       |\n| `minimize-detected-comments` | Whether to minimize comments detected as spam                                      | `true`                | No       |\n| `custom-prompt-path`         | Path to a custom YAML prompt file in your repository (relative to repository root) | (none)                | No       |\n| `enable-spam-detection`      | Enable built-in spam detection prompt                                              | `true`                | No       |\n| `enable-link-spam-detection` | Enable built-in link spam detection prompt                                         | `true`                | No       |\n| `enable-ai-detection`        | Enable built-in AI-generated content detection prompt                              | `true`                | No       |\n\n## Inference\n\nThe action does not require any external API keys for inference - it uses the\nbuilt-in GitHub token with `models: read` permission to access GitHub Models.\n\nEvery GitHub user has GitHub Models inference for free, but if you're running\ninto rate limiting issues you can choose to\n[opt in to paid usage](https://docs.github.com/en/billing/managing-billing-for-your-products/about-billing-for-github-models).\n\n### Default prompts\n\nThe action uses built-in YAML prompts located in the `prompts/` directory. Each\nprompt can be individually enabled or disabled using the configuration options:\n\n- **`spam-detection.prompt.yml`**: Detects promotional content, scams, and\n  irrelevant posts (controlled by `enable-spam-detection`)\n- **`ai-detection.prompt.yml`**: Identifies AI-generated content patterns\n  (controlled by `enable-ai-detection`)\n- **`link-spam-detection.prompt.yml`**: Focuses on suspicious links and URLs\n  (controlled by `enable-link-spam-detection`)\n\nAll prompts are enabled by default. You can selectively disable them based on\nyour repository's moderation needs:\n\n```yaml\n- uses: github/ai-moderator\n  with:\n    token: ${{ secrets.GITHUB_TOKEN }}\n    enable-spam-detection: true # Enable general spam detection\n    enable-link-spam-detection: false # Disable link spam detection\n    enable-ai-detection: true # Enable AI content detection\n```\n\nYou can iterate on or tweak these prompts via the\n[Models tab](https://github.com/github/ai-moderator/models) on this repository.\nIf you want to push an update to this prompt, please also include updated test\ndata so we can see the effect of the prompt update.\n\n### Custom prompts\n\nYou can also provide your own custom prompt file in your repository using the\n`custom-prompt-path` input:\n\n```yaml\n- uses: github/ai-moderator\n  with:\n    token: ${{ secrets.GITHUB_TOKEN }}\n    custom-prompt-path: '.github/prompts/my-custom-spam-detection.prompt.yml'\n```\n\nCustom prompt files should follow the same YAML format as the built-in prompts.\nAn example custom prompt file is included at\n`.github/prompts/example-custom.prompt.yml` that demonstrates the proper format\nand shows how to create repository-specific spam detection rules.\n\n## Development\n\n```bash\n# Install dependencies\nnpm install\n\n# Run tests\nnpm test\n\n# Build the action\nnpm run package\n\n# Run linting\nnpm run lint\n```\n\n### Testing\n\nThe action includes comprehensive tests for all modules:\n\n```bash\n# Run all tests with coverage\nnpm run test\n\n# Run tests in watch mode\nnpm run test:watch\n```\n\n## License\n\nThis project is licensed under the terms of the MIT open source license. Please\nrefer to [LICENSE](./LICENSE) for the full terms.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithub%2Fai-moderator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgithub%2Fai-moderator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithub%2Fai-moderator/lists"}