3636 spam-label : ' spam'
3737 ai-label : ' ai-generated'
3838 minimize-detected-comments : true
39+ # Built-in prompt configuration (all enabled by default)
40+ enable-spam-detection : true
41+ enable-link-spam-detection : true
42+ enable-ai-detection : true
3943 # custom-prompt-path: '.github/prompts/my-custom.prompt.yml' # Optional
4044```
4145
4852| ` ai-label ` | Label to add when AI-generated content is detected | ` ai-generated ` | No |
4953| ` minimize-detected-comments ` | Whether to minimize comments detected as spam | ` true ` | No |
5054| ` custom-prompt-path ` | Path to a custom YAML prompt file in your repository (relative to repo root) | (none) | No |
55+ | ` enable-spam-detection ` | Enable built-in spam detection prompt | ` true ` | No |
56+ | ` enable-link-spam-detection ` | Enable built-in link spam detection prompt | ` true ` | No |
57+ | ` enable-ai-detection ` | Enable built-in AI-generated content detection prompt | ` true ` | No |
5158
5259### Inference
5360
@@ -60,13 +67,27 @@ into rate limiting issues you can choose to
6067
6168## Detection Prompts
6269
63- The action uses built-in YAML prompts located in the ` prompts/ ` directory:
70+ The action uses built-in YAML prompts located in the ` prompts/ ` directory. Each
71+ prompt can be individually enabled or disabled using the configuration options:
6472
6573- ** ` spam-detection.prompt.yml ` ** : Detects promotional content, scams, and
66- irrelevant posts
74+ irrelevant posts (controlled by ` enable-spam-detection ` )
6775- ** ` ai-detection.prompt.yml ` ** : Identifies AI-generated content patterns
68- - ** ` bot- detection.prompt.yml ` ** : Identifies automated bot behavior
76+ (controlled by ` enable-ai- detection` )
6977- ** ` link-spam-detection.prompt.yml ` ** : Focuses on suspicious links and URLs
78+ (controlled by ` enable-link-spam-detection ` )
79+
80+ All prompts are enabled by default. You can selectively disable them based on
81+ your repository's moderation needs:
82+
83+ ``` yaml
84+ - uses : github/ai-spam-guard
85+ with :
86+ token : ${{ secrets.GITHUB_TOKEN }}
87+ enable-spam-detection : true # Enable general spam detection
88+ enable-link-spam-detection : false # Disable link spam detection
89+ enable-ai-detection : true # Enable AI content detection
90+ ` ` `
7091
7192You can iterate on or tweak these prompts via the
7293[Models tab](https://github.com/github/ai-spam-guard/models) on this repository.
@@ -85,62 +106,7 @@ You can also provide your own custom prompt file in your repository using the
85106 custom-prompt-path: '.github/prompts/my-custom-spam-detection.prompt.yml'
86107` ` `
87108
88- Custom prompt files should follow the same YAML format as the built-in prompts:
89-
90- ` ` ` yaml
91- messages :
92- - role : system
93- content : |
94- You are a content moderation system. Analyze the provided content
95- and determine if it violates repository guidelines.
96-
97- Consider these indicators:
98- - Off-topic discussions
99- - Inappropriate language
100- - Spam or promotional content
101-
102- Provide your analysis in the specified JSON format.
103- - role : user
104- content : |
105- Analyze this content:
106-
107- {{stdin}}
108- model : gpt-4o
109- responseFormat : json_schema
110- jsonSchema : |-
111- {
112- "name": "spam_detection_result",
113- "strict": true,
114- "schema": {
115- "type": "object",
116- "properties": {
117- "reasoning": {
118- "type": "string",
119- "description": "Detailed explanation of the analysis"
120- },
121- "is_spam": {
122- "type": "boolean",
123- "description": "Whether the content violates guidelines"
124- }
125- },
126- "additionalProperties": false,
127- "required": ["reasoning", "is_spam"]
128- }
129- }
130- ` ` `
131-
132- **Notes:**
133-
134- - Custom prompts are treated as spam detection prompts by default (unless the
135- filename contains "ai-detection")
136- - Custom prompts are evaluated **before** the built-in prompts
137- - The ` {{stdin}}` placeholder will be replaced with the actual content to
138- analyze
139- - Custom prompts must return a JSON response with at least `reasoning` and
140- ` is_spam` fields
141-
142- # ## Example Custom Prompt
143-
109+ Custom prompt files should follow the same YAML format as the built-in prompts.
144110An example custom prompt file is included at
145111` .github/prompts/example-custom.prompt.yml` that demonstrates the proper format
146112and shows how to create repository-specific spam detection rules.
0 commit comments