spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

claude-code / .github / workflows / claude-issue-triage.yml
106 lines · 6.0 KBRaw
1name: Claude Issue Triage
2on:
3 issues:
4 types: [opened]
5 issue_comment:
6 types: [created]
7
8jobs:
9 triage-issue:
10 runs-on: ubuntu-latest
11 timeout-minutes: 10
12 if: >-
13 github.event_name == 'issues' ||
14 (github.event_name == 'issue_comment' && !github.event.issue.pull_request && github.event.comment.user.type != 'Bot')
15 concurrency:
16 group: issue-triage-${{ github.event.issue.number }}
17 cancel-in-progress: true
18 permissions:
19 contents: read
20 issues: write
21 id-token: write
22
23 steps:
24 - name: Checkout repository
25 uses: actions/checkout@v4
26
27 - name: Run Claude Code for Issue Triage
28 timeout-minutes: 5
29 uses: anthropics/claude-code-action@v1
30 env:
31 GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32 with:
33 github_token: ${{ secrets.GITHUB_TOKEN }}
34 allowed_non_write_users: "*"
35 prompt: |
36 You're an issue triage assistant. Analyze the issue and manage labels.
37
38 IMPORTANT: Don't post any comments or messages to the issue. Your only actions are adding or removing labels.
39
40 Context:
41 - REPO: ${{ github.repository }}
42 - ISSUE_NUMBER: ${{ github.event.issue.number }}
43 - EVENT: ${{ github.event_name }}
44
45 ALLOWED LABELS — you may ONLY use labels from this list. Never invent new labels.
46
47 Type: bug, enhancement, question, documentation, duplicate, invalid
48 Lifecycle: needs-repro, needs-info, stale, autoclose
49 Platform: platform:linux, platform:macos, platform:windows, platform:wsl, platform:ios, platform:android, platform:vscode, platform:intellij, platform:web, platform:aws-bedrock
50 API: api:bedrock, api:vertex
51
52 TOOLS:
53 - `gh issue view NUMBER`: Read the issue title, body, and labels
54 - `gh issue view NUMBER --comments`: Read the conversation
55 - `gh search issues QUERY`: Find similar or duplicate issues
56 - `gh issue edit NUMBER --add-label` / `--remove-label`: Add or remove labels
57
58 TASK:
59
60 1. Run `gh issue view ${{ github.event.issue.number }}` to read the issue details.
61 2. Run `gh issue view ${{ github.event.issue.number }} --comments` to read the conversation.
62
63 **If EVENT is "issues" (new issue):**
64
65 3. First, check if this issue is actually about Claude Code (the CLI/IDE tool). Issues about the Claude API, claude.ai, the Claude app, Anthropic billing, or other Anthropic products should be labeled `invalid`. If invalid, apply only that label and stop.
66
67 4. Analyze and apply category labels:
68 - Type (bug, enhancement, question, etc.)
69 - Technical areas and platform
70 - Check for duplicates with `gh search issues`. Only mark as duplicate of OPEN issues.
71
72 5. Evaluate lifecycle labels:
73 - `needs-repro` (bugs only, 7 days): Bug reports without clear steps to reproduce. A good repro has specific, followable steps that someone else could use to see the same issue.
74 Do NOT apply if the user already provided error messages, logs, file paths, or a description of what they did. Don't require a specific format — narrative descriptions count.
75 For model behavior issues (e.g. "Claude does X when it should do Y"), don't require traditional repro steps — examples and patterns are sufficient.
76 - `needs-info` (bugs only, 7 days): The issue needs something from the community before it can progress — e.g. error messages, versions, environment details, or answers to follow-up questions. Don't apply to questions or enhancements.
77 Do NOT apply if the user already provided version, environment, and error details. If the issue just needs engineering investigation, that's not `needs-info`.
78
79 Issues with these labels are automatically closed after the timeout if there's no response.
80 The goal is to avoid issues lingering without a clear next step.
81
82 6. Apply all selected labels:
83 `gh issue edit ${{ github.event.issue.number }} --add-label "label1" --add-label "label2"`
84
85 **If EVENT is "issue_comment" (comment on existing issue):**
86
87 3. Evaluate lifecycle labels based on the full conversation:
88 - If the issue has `stale` or `autoclose`, remove the label — a new human comment means the issue is still active:
89 `gh issue edit ${{ github.event.issue.number }} --remove-label "stale" --remove-label "autoclose"`
90 - If the issue has `needs-repro` or `needs-info` and the missing information has now been provided, remove the label:
91 `gh issue edit ${{ github.event.issue.number }} --remove-label "needs-repro"`
92 - If the issue doesn't have lifecycle labels but clearly needs them (e.g., a maintainer asked for repro steps or more details), add the appropriate label.
93 - Comments like "+1", "me too", "same here", or emoji reactions are NOT the missing information. Only remove `needs-repro` or `needs-info` when substantive details are actually provided.
94 - Do NOT add or remove category labels (bug, enhancement, etc.) on comment events.
95
96 GUIDELINES:
97 - ONLY use labels from the ALLOWED LABELS list above — never create or guess label names
98 - DO NOT post any comments to the issue
99 - Be conservative with lifecycle labels — only apply when clearly warranted
100 - Only apply lifecycle labels (`needs-repro`, `needs-info`) to bugs — never to questions or enhancements
101 - When in doubt, don't apply a lifecycle label — false positives are worse than missing labels
102 - It's okay to not add any labels if none are clearly applicable
103 anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
104 claude_args: |
105 --model claude-opus-4-6
106 --allowedTools "Bash(gh issue view:*),Bash(gh issue edit:*),Bash(gh search issues:*)"