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