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
102 lines · 4.6 KBRaw
1name: Claude Issue Triage
2description: Automatically triage GitHub issues using Claude Code
3on:
4 issues:
5 types: [opened]
6
7jobs:
8 triage-issue:
9 runs-on: ubuntu-latest
10 timeout-minutes: 10
11 permissions:
12 contents: read
13 issues: write
14
15 steps:
16 - name: Checkout repository
17 uses: actions/checkout@v4
18
19 - name: Setup GitHub MCP Server
20 run: |
21 mkdir -p /tmp/mcp-config
22 cat > /tmp/mcp-config/mcp-servers.json << 'EOF'
23 {
24 "mcpServers": {
25 "github": {
26 "command": "docker",
27 "args": [
28 "run",
29 "-i",
30 "--rm",
31 "-e",
32 "GITHUB_PERSONAL_ACCESS_TOKEN",
33 "ghcr.io/github/github-mcp-server:sha-7aced2b"
34 ],
35 "env": {
36 "GITHUB_PERSONAL_ACCESS_TOKEN": "${{ secrets.GITHUB_TOKEN }}"
37 }
38 }
39 }
40 }
41 EOF
42
43 - name: Run Claude Code for Issue Triage
44 timeout-minutes: 5
45 uses: anthropics/claude-code-action@v1
46 env:
47 GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48 with:
49 prompt: |
50 You're an issue triage assistant for GitHub issues. Your task is to analyze the issue and select appropriate labels from the provided list.
51
52 IMPORTANT: Don't post any comments or messages to the issue. Your only action should be to apply labels.
53
54 Issue Information:
55 - REPO: ${{ github.repository }}
56 - ISSUE_NUMBER: ${{ github.event.issue.number }}
57
58 TASK OVERVIEW:
59
60 1. First, fetch the list of labels available in this repository by running: `gh label list`. Run exactly this command with nothing else.
61
62 2. Next, use the GitHub tools to get context about the issue:
63 - You have access to these tools:
64 - mcp__github__get_issue: Use this to retrieve the current issue's details including title, description, and existing labels
65 - mcp__github__get_issue_comments: Use this to read any discussion or additional context provided in the comments
66 - mcp__github__update_issue: Use this to apply labels to the issue (do not use this for commenting)
67 - mcp__github__search_issues: Use this to find similar issues that might provide context for proper categorization and to identify potential duplicate issues
68 - mcp__github__list_issues: Use this to understand patterns in how other issues are labeled
69 - Start by using mcp__github__get_issue to get the issue details
70
71 3. Analyze the issue content, considering:
72 - The issue title and description
73 - The type of issue (bug report, feature request, question, etc.)
74 - Technical areas mentioned
75 - Severity or priority indicators
76 - User impact
77 - Components affected
78
79 4. Select appropriate labels from the available labels list provided above:
80 - Choose labels that accurately reflect the issue's nature
81 - Be specific but comprehensive
82 - Select priority labels if you can determine urgency (high-priority, med-priority, or low-priority)
83 - Consider platform labels (android, ios) if applicable
84 - If you find similar issues using mcp__github__search_issues, consider using a "duplicate" label if appropriate. Only do so if the issue is a duplicate of another OPEN issue.
85
86 5. Apply the selected labels:
87 - Use mcp__github__update_issue to apply your selected labels
88 - DO NOT post any comments explaining your decision
89 - DO NOT communicate directly with users
90 - If no labels are clearly applicable, do not apply any labels
91
92 IMPORTANT GUIDELINES:
93 - Be thorough in your analysis
94 - Only select labels from the provided list above
95 - DO NOT post any comments to the issue
96 - Your ONLY action should be to apply labels using mcp__github__update_issue
97 - It's okay to not add any labels if none are clearly applicable
98 anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
99 claude_args: |
100 --model claude-sonnet-4-5-20250929
101 --mcp-config /tmp/mcp-config/mcp-servers.json
102 --allowedTools "Bash(gh label list),mcp__github__get_issue,mcp__github__get_issue_comments,mcp__github__update_issue,mcp__github__search_issues,mcp__github__list_issues"