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 / actions / claude-issue-triage-action / action.yml
87 lines · 4.1 KBRaw
1name: "Claude Issue Triage Action"
2description: "Automatically triage GitHub issues using Claude Code"
3
4inputs:
5 timeout_minutes:
6 description: "Timeout in minutes for execution"
7 required: false
8 default: "5"
9 anthropic_api_key:
10 description: "Anthropic API key"
11 required: true
12 github_token:
13 description: "GitHub token with repo and issues permissions"
14 required: true
15
16runs:
17 using: "composite"
18 steps:
19 - name: Checkout repository code
20 uses: actions/checkout@v4
21 with:
22 fetch-depth: 0
23
24 - name: Create prompt file
25 shell: bash
26 run: |
27 mkdir -p /tmp/claude-prompts
28 cat > /tmp/claude-prompts/claude-issue-triage-prompt.txt << 'EOF'
29 You're an issue triage assistant for GitHub issues. Your task is to analyze the issue and select appropriate labels from the provided list.
30
31 IMPORTANT: Don't post any comments or messages to the issue. Your only action should be to apply labels.
32
33 Issue Information:
34 - REPO: ${{ github.repository }}
35 - ISSUE_NUMBER: ${{ github.event.issue.number }}
36
37 TASK OVERVIEW:
38
39 1. First, fetch the list of labels available in this repository by running: `gh label list`. Run exactly this command with nothing else.
40
41 2. Next, use the GitHub tools to get context about the issue:
42 - You have access to these tools:
43 - mcp__github__get_issue: Use this to retrieve the current issue's details including title, description, and existing labels
44 - mcp__github__get_issue_comments: Use this to read any discussion or additional context provided in the comments
45 - mcp__github__update_issue: Use this to apply labels to the issue (do not use this for commenting)
46 - mcp__github__search_issues: Use this to find similar issues that might provide context for proper categorization and to identify potential duplicate issues
47 - mcp__github__list_issues: Use this to understand patterns in how other issues are labeled
48 - Start by using mcp__github__get_issue to get the issue details
49
50 3. Analyze the issue content, considering:
51 - The issue title and description
52 - The type of issue (bug report, feature request, question, etc.)
53 - Technical areas mentioned
54 - Severity or priority indicators
55 - User impact
56 - Components affected
57
58 4. Select appropriate labels from the available labels list provided above:
59 - Choose labels that accurately reflect the issue's nature
60 - Be specific but comprehensive
61 - Select priority labels if you can determine urgency (high-priority, med-priority, or low-priority)
62 - Consider platform labels (android, ios) if applicable
63 - 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.
64
65 5. Apply the selected labels:
66 - Use mcp__github__update_issue to apply your selected labels
67 - DO NOT post any comments explaining your decision
68 - DO NOT communicate directly with users
69 - If no labels are clearly applicable, do not apply any labels
70
71 IMPORTANT GUIDELINES:
72 - Be thorough in your analysis
73 - Only select labels from the provided list above
74 - DO NOT post any comments to the issue
75 - Your ONLY action should be to apply labels using mcp__github__update_issue
76 - It's okay to not add any labels if none are clearly applicable
77 EOF
78
79 - name: Run Claude Code
80 uses: ./.github/actions/claude-code-action
81 with:
82 prompt_file: /tmp/claude-prompts/claude-issue-triage-prompt.txt
83 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"
84 install_github_mcp: "true"
85 timeout_minutes: ${{ inputs.timeout_minutes }}
86 anthropic_api_key: ${{ inputs.anthropic_api_key }}
87 github_token: ${{ inputs.github_token }}