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