-
-
Notifications
You must be signed in to change notification settings - Fork 43
542 lines (425 loc) · 20.8 KB
/
issue-triage.yml
File metadata and controls
542 lines (425 loc) · 20.8 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
name: Automated Issue Triage
on:
issues:
types: [opened, labeled]
issue_comment:
types: [created]
permissions:
contents: read
issues: write
pull-requests: read
id-token: write # Required for Claude Code Action OIDC authentication
concurrency:
group: issue-triage-${{ github.event.issue.number }}
cancel-in-progress: false
jobs:
# Quick auto-labeling based on keywords (runs immediately, no API cost)
auto-label:
runs-on: ubuntu-latest
if: github.event_name == 'issues' && github.event.action == 'opened'
steps:
- name: Auto-label based on keywords
uses: actions/github-script@v8
with:
script: |
const title = context.payload.issue.title.toLowerCase();
const body = (context.payload.issue.body || '').toLowerCase();
const labels = [];
// Detect bug vs feature from title tags
if (title.includes('[bug]')) {
labels.push('bug');
} else if (title.includes('[feat]') || title.includes('[feature]')) {
labels.push('enhancement');
}
// Topic-based labels
if (body.includes('docker') || title.includes('docker')) {
labels.push('docker');
}
if (body.includes('apprise') || title.includes('apprise')) {
labels.push('apprise');
}
if (body.includes('configuration') || body.includes('config') || title.includes('config')) {
labels.push('configuration');
}
if (body.includes('meshtastic') || title.includes('meshtastic')) {
labels.push('meshtastic');
}
if (body.includes('notification') || title.includes('notification')) {
labels.push('notifications');
}
// Apply labels if any were detected
if (labels.length > 0) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: labels
});
console.log(`Auto-applied labels: ${labels.join(', ')}`);
}
# AI-powered triage for new issues
triage-new-issue:
runs-on: ubuntu-latest
# Only run on new issues, skip bots
if: |
github.event_name == 'issues' &&
github.event.action == 'opened' &&
github.actor != 'dependabot[bot]' &&
github.actor != 'github-actions[bot]'
steps:
- name: Check user permissions
id: check-permissions
uses: actions/github-script@v8
with:
script: |
try {
const { data: permission } = await github.rest.repos.getCollaboratorPermissionLevel({
owner: context.repo.owner,
repo: context.repo.repo,
username: context.actor
});
const hasWriteAccess = ['write', 'admin', 'maintain'].includes(permission.permission);
console.log(`Actor: ${context.actor}, Permission: ${permission.permission}, Has write access: ${hasWriteAccess}`);
core.setOutput('has_write_access', hasWriteAccess);
return hasWriteAccess;
} catch (error) {
console.log(`Error checking permissions: ${error.message}`);
core.setOutput('has_write_access', false);
return false;
}
- name: Checkout repository
if: steps.check-permissions.outputs.has_write_access == 'true'
uses: actions/checkout@v6
with:
fetch-depth: 1
- name: Triage with Claude
if: steps.check-permissions.outputs.has_write_access == 'true'
uses: anthropics/claude-code-action@beta
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
github_token: ${{ secrets.CLAUDE_GITHUB_TOKEN }}
model: "claude-sonnet-4-20250514"
direct_prompt: |
🤖 **Automated Issue Triage**
A new issue has been submitted. Your job is to provide an initial response following these STRICT guidelines:
## Step 1: Classify the Issue
First, determine if this is:
- **BUG**: Something is broken or not working as expected
- **FEATURE**: New functionality request or enhancement
- **QUESTION**: User needs help or clarification
- **DUPLICATE**: Already reported in another issue
Note: Some issues labeled as bugs might actually be feature requests. Reclassify if needed.
## Step 2: Check for Duplicates
Search both OPEN and CLOSED issues for similar reports:
- Use Grep/Glob to search issue templates and existing issues
- If you find a duplicate:
1. Post a comment: "Closing as duplicate of #XXX" (reference the original issue number)
2. Add the 'duplicate' label
3. Close the issue
4. STOP - do not continue analysis
## Step 3: Response Based on Type
### For BUG Reports:
1. **Analyze the issue description** - what information is provided?
2. **Check the codebase** - look for relevant code sections that might be involved
3. **Search for similar patterns** - check if this is a known pattern
4. **Provide diagnostic steps** - give the user specific commands/checks to run
5. **Reference documentation** - link to relevant docs from:
- https://meshmonitor.org (primary documentation)
- https://meshtastic.org (Meshtastic protocol/device docs)
- https://docs.docker.com (if Docker-related)
- https://github.com/caronc/apprise/wiki (if Apprise/notifications)
Your response should:
- Start with "🤖 **Automated Triage**" header
- Summarize what you understand about the bug
- List specific diagnostic steps for the user to run
- Include expected outputs for each step
- Reference relevant documentation
- Be helpful and professional
Example format:
```
🤖 **Automated Triage**
Thank you for reporting this issue! This appears to be [brief summary of the bug].
To help diagnose this issue, please run the following diagnostic steps:
### 1. [Diagnostic step name]
[command or check to perform]
[what to look for in output]
### 2. [Next diagnostic step]
...
### Documentation References
- [Relevant meshmonitor.org link]
- [Relevant external docs]
Please share the outputs from these diagnostics, and I'll analyze the results.
```
IMPORTANT: This is your FIRST response. Do not repeat the same diagnostic steps later.
### For FEATURE Requests:
1. **Search the codebase** - look for similar existing features
2. **Check closed issues/PRs** - see if this was already implemented or rejected
3. **Search documentation** - find related features on meshmonitor.org
4. **Provide links** - point user to existing documentation and similar features
Your response should:
- Start with "🤖 **Automated Triage**" header
- Acknowledge the feature request
- Link to any similar existing features with documentation
- Reference relevant meshmonitor.org pages
- Be concise - ONE response only
- Do NOT continue the conversation beyond this first response
Example format:
```
🤖 **Automated Triage**
Thank you for the feature request!
We have some related functionality that might help:
- [Existing Feature Name]: [link to meshmonitor.org docs]
- [Related Feature]: [link to docs]
You might also find these resources helpful:
- [Relevant meshmonitor.org documentation]
- [External documentation if applicable]
A maintainer will review your request and provide feedback.
```
## Step 4: Apply Labels
Based on your analysis, suggest labels by mentioning them in your response:
- bug / enhancement / question / duplicate
- docker / apprise / configuration / meshtastic / notifications
- needs-maintainer-review (if the issue needs human attention)
## Available Tools
You have access to:
- Read: Read files from the codebase
- Grep: Search for patterns in code
- Glob: Find files by pattern
- Bash: Run read-only commands (git log, gh issue list, etc.)
Use these to understand the codebase and find similar issues/features.
## Important Reminders
- Be professional and helpful
- Identify yourself as automated (🤖 prefix)
- For bugs: provide detailed diagnostics
- For features: link to existing docs, one response only
- For duplicates: close with reference to original
- Liberally reference official documentation
- Use tools to search codebase and issues
Now analyze the issue and provide your response!
# Manual triage trigger via label (for external contributors)
triage-on-label:
runs-on: ubuntu-latest
# Only run when needs-triage label is added
if: |
github.event_name == 'issues' &&
github.event.action == 'labeled' &&
github.event.label.name == 'needs-triage'
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 1
- name: Triage with Claude
uses: anthropics/claude-code-action@beta
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
github_token: ${{ secrets.CLAUDE_GITHUB_TOKEN }}
model: "claude-sonnet-4-20250514"
direct_prompt: |
🤖 **Automated Issue Triage** (Manual Trigger)
A maintainer has requested AI triage for this issue. Your job is to provide an initial response following these STRICT guidelines:
## Step 1: Classify the Issue
First, determine if this is:
- **BUG**: Something is broken or not working as expected
- **FEATURE**: New functionality request or enhancement
- **QUESTION**: User needs help or clarification
- **DUPLICATE**: Already reported in another issue
Note: Some issues labeled as bugs might actually be feature requests. Reclassify if needed.
## Step 2: Check for Duplicates
Search both OPEN and CLOSED issues for similar reports:
- Use Grep/Glob to search issue templates and existing issues
- If you find a duplicate:
1. Post a comment: "Closing as duplicate of #XXX" (reference the original issue number)
2. Add the 'duplicate' label
3. Close the issue
4. STOP - do not continue analysis
## Step 3: Response Based on Type
### For BUG Reports:
1. **Analyze the issue description** - what information is provided?
2. **Check the codebase** - look for relevant code sections that might be involved
3. **Search for similar patterns** - check if this is a known pattern
4. **Provide diagnostic steps** - give the user specific commands/checks to run
5. **Reference documentation** - link to relevant docs from:
- https://meshmonitor.org (primary documentation)
- https://meshtastic.org (Meshtastic protocol/device docs)
- https://docs.docker.com (if Docker-related)
- https://github.com/caronc/apprise/wiki (if Apprise/notifications)
Your response should:
- Start with "🤖 **Automated Triage**" header
- Summarize what you understand about the bug
- List specific diagnostic steps for the user to run
- Include expected outputs for each step
- Reference relevant documentation
- Be helpful and professional
Example format:
```
🤖 **Automated Triage**
Thank you for reporting this issue! This appears to be [brief summary of the bug].
To help diagnose this issue, please run the following diagnostic steps:
### 1. [Diagnostic step name]
[command or check to perform]
[what to look for in output]
### 2. [Next diagnostic step]
...
### Documentation References
- [Relevant meshmonitor.org link]
- [Relevant external docs]
Please share the outputs from these diagnostics, and I'll analyze the results.
```
IMPORTANT: This is your FIRST response. Do not repeat the same diagnostic steps later.
### For FEATURE Requests:
1. **Search the codebase** - look for similar existing features
2. **Check closed issues/PRs** - see if this was already implemented or rejected
3. **Search documentation** - find related features on meshmonitor.org
4. **Provide links** - point user to existing documentation and similar features
Your response should:
- Start with "🤖 **Automated Triage**" header
- Acknowledge the feature request
- Link to any similar existing features with documentation
- Reference relevant meshmonitor.org pages
- Be concise - ONE response only
- Do NOT continue the conversation beyond this first response
Example format:
```
🤖 **Automated Triage**
Thank you for the feature request!
We have some related functionality that might help:
- [Existing Feature Name]: [link to meshmonitor.org docs]
- [Related Feature]: [link to docs]
You might also find these resources helpful:
- [Relevant meshmonitor.org documentation]
- [External documentation if applicable]
A maintainer will review your request and provide feedback.
```
## Step 4: Apply Labels
Based on your analysis, suggest labels by mentioning them in your response:
- bug / enhancement / question / duplicate
- docker / apprise / configuration / meshtastic / notifications
- needs-maintainer-review (if the issue needs human attention)
## Available Tools
You have access to:
- Read: Read files from the codebase
- Grep: Search for patterns in code
- Glob: Find files by pattern
- Bash: Run read-only commands (git log, gh issue list, etc.)
Use these to understand the codebase and find similar issues/features.
## Important Reminders
- Be professional and helpful
- Identify yourself as automated (🤖 prefix)
- For bugs: provide detailed diagnostics
- For features: link to existing docs, one response only
- For duplicates: close with reference to original
- Liberally reference official documentation
- Use tools to search codebase and issues
Now analyze the issue and provide your response!
- name: Remove needs-triage label
if: always()
uses: actions/github-script@v8
with:
script: |
try {
await github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
name: 'needs-triage'
});
console.log('Removed needs-triage label');
} catch (error) {
console.log(`Error removing label: ${error.message}`);
}
# Follow-up analysis when users respond to bug diagnostic requests
triage-followup:
runs-on: ubuntu-latest
# Only run on issue comments, skip bots, skip PR comments
if: |
github.event_name == 'issue_comment' &&
github.event.action == 'created' &&
!github.event.issue.pull_request &&
github.actor != 'dependabot[bot]' &&
github.actor != 'github-actions[bot]' &&
github.actor != 'Yeraze'
steps:
- name: Check user permissions
id: check-permissions
uses: actions/github-script@v8
with:
script: |
try {
const { data: permission } = await github.rest.repos.getCollaboratorPermissionLevel({
owner: context.repo.owner,
repo: context.repo.repo,
username: context.actor
});
const hasWriteAccess = ['write', 'admin', 'maintain'].includes(permission.permission);
console.log(`Actor: ${context.actor}, Permission: ${permission.permission}, Has write access: ${hasWriteAccess}`);
core.setOutput('has_write_access', hasWriteAccess);
return hasWriteAccess;
} catch (error) {
console.log(`Error checking permissions: ${error.message}`);
core.setOutput('has_write_access', false);
return false;
}
- name: Checkout repository
if: steps.check-permissions.outputs.has_write_access == 'true'
uses: actions/checkout@v6
with:
fetch-depth: 1
- name: Check if this is a bug issue needing follow-up
if: steps.check-permissions.outputs.has_write_access == 'true'
id: check-bug
uses: actions/github-script@v8
with:
script: |
const issue = context.payload.issue;
const labels = issue.labels.map(l => l.name);
// Only analyze bugs that don't already have maintainer review
const isBug = labels.includes('bug');
const needsReview = labels.includes('needs-maintainer-review');
console.log(`Is bug: ${isBug}, Needs review: ${needsReview}`);
core.setOutput('should_analyze', isBug && !needsReview);
- name: Follow-up Analysis with Claude
if: steps.check-permissions.outputs.has_write_access == 'true' && steps.check-bug.outputs.should_analyze == 'true'
uses: anthropics/claude-code-action@beta
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
github_token: ${{ secrets.CLAUDE_GITHUB_TOKEN }}
model: "claude-sonnet-4-20250514"
direct_prompt: |
🤖 **Automated Follow-up Analysis**
The user has responded to a bug report with additional information. Your job is to analyze their response and determine next steps.
## Your Task
1. **Read the full issue thread** - understand the original bug and all responses
2. **Analyze the diagnostic results** - what did the user provide?
3. **Determine if there's new information** - can we make progress?
4. **Decide on next action**:
- If NEW useful information → provide next diagnostic steps
- If NO new information OR stuck → tag @Yeraze and add 'needs-maintainer-review' label
- If issue appears RESOLVED → ask user to confirm, suggest closing
## Response Guidelines
### If you have next steps:
```
🤖 **Follow-up Analysis**
Thank you for providing those diagnostics! Based on the results, I can see [what you learned].
Next steps:
### [Next diagnostic or fix to try]
[specific instructions]
[Continue with additional steps if needed]
```
### If you're stuck or no new info:
```
🤖 **Follow-up Analysis**
Thank you for the additional information. Based on what you've provided, this issue requires maintainer attention.
@Yeraze - This issue needs your review. Summary:
- [Brief summary of the issue]
- [What diagnostics were run]
- [Current status/findings]
[Add 'needs-maintainer-review' label by mentioning it]
```
## Important Rules
- Do NOT repeat the same diagnostic steps that were already requested
- Do NOT continue asking for the same information
- If stuck after 2-3 back-and-forth exchanges → escalate to @Yeraze
- Be honest when you've reached the limit of automated triage
- Continue referencing documentation when relevant
Now analyze the user's response and provide your follow-up!