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
95 lines · 4.5 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. Identify existing duplicate issues:
59 - Use mcp__github__search_issues to find similar issues
60 - List out all open or recently closed issues that seem likely to be reports of the same problem
61 - Place the best candidate issue to merge into at the top of the list.
62 The best candidate issue is the one that is:
63 1. Has the same underlying cause as the current issue
64 2. Is the most complete and well-documented
65 3. Is the oldest open issue that is still relevant
66
67 5. Select appropriate labels from the available labels list provided above:
68 - Choose labels that accurately reflect the issue's nature
69 - Be specific but comprehensive
70 - Consider platform labels (macos, linux, windows) if applicable
71 - Do not apply the "duplicate" label unless you are certain the issue is a duplicate of another open issue
72
73 6. Apply the selected labels:
74 - Use mcp__github__update_issue to apply your selected labels
75 - DO NOT post any comments explaining your decision
76 - DO NOT communicate directly with users
77 - If no labels are clearly applicable, do not apply any labels
78
79 IMPORTANT GUIDELINES:
80 - Be thorough in your analysis
81 - Only select labels from the provided list above
82 - DO NOT post any comments to the issue
83 - Your ONLY action should be to apply labels using mcp__github__update_issue
84 - It's okay to not add any labels if none are clearly applicable
85 EOF
86
87 - name: Run Claude Code
88 uses: ./.github/actions/claude-code-action
89 with:
90 prompt_file: /tmp/claude-prompts/claude-issue-triage-prompt.txt
91 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"
92 install_github_mcp: "true"
93 timeout_minutes: ${{ inputs.timeout_minutes }}
94 anthropic_api_key: ${{ inputs.anthropic_api_key }}
95 github_token: ${{ inputs.github_token }}