-
Notifications
You must be signed in to change notification settings - Fork 3
61 lines (55 loc) · 2.07 KB
/
triage-detect-spam.yml
File metadata and controls
61 lines (55 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: 'Triage: Detect spam issues'
# Expected triggers: issues: [opened]
# Uses AI to detect spam issues and labels them as suspected-spam.
# The triage-close-suspected-spam workflow handles commenting and closing.
on:
workflow_call:
inputs:
project_context:
description: 'Description of the project to help the AI understand what legitimate issues look like (e.g., "GitHub Desktop is a GUI application for interacting with GitHub repositories")'
type: string
required: false
default: ''
spam_label:
description: 'Label to add to detected spam issues'
type: string
required: false
default: 'suspected-spam'
model:
description: 'AI model to use for spam detection'
type: string
required: false
default: 'openai/gpt-4o-mini'
secrets:
automation_token:
description: 'Token with permissions to comment, label, and close issues (defaults to github.token)'
required: false
permissions:
contents: read
issues: write
models: read
jobs:
detect-spam:
runs-on: ubuntu-latest
steps:
- name: Checkout shared workflows
uses: actions/checkout@v6
with:
repository: desktop/gh-cli-and-desktop-shared-workflows
path: shared-workflows
sparse-checkout: .github/workflows/scripts/spam-detection
- name: Checkout calling repository (for issue templates)
uses: actions/checkout@v6
with:
path: calling-repo
sparse-checkout: .github/ISSUE_TEMPLATE
- name: Run spam detection
env:
GH_TOKEN: ${{ secrets.automation_token || github.token }}
ISSUE_URL: ${{ github.event.issue.html_url }}
PROJECT_CONTEXT: ${{ inputs.project_context }}
SPAM_LABEL: ${{ inputs.spam_label || 'suspected-spam' }}
MODEL: ${{ inputs.model || 'openai/gpt-4o-mini' }}
TEMPLATE_DIR: calling-repo/.github/ISSUE_TEMPLATE
run: |
bash shared-workflows/.github/workflows/scripts/spam-detection/process-issue.sh "$ISSUE_URL"