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
| 1 | name: "Claude Issue Triage Action" |
| 2 | description: "Automatically triage GitHub issues using Claude Code" |
| 3 | |
| 4 | inputs: |
| 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 | issue_number: |
| 16 | description: "Issue number to triage (optional - defaults to event issue number)" |
| 17 | required: false |
| 18 | |
| 19 | runs: |
| 20 | using: "composite" |
| 21 | steps: |
| 22 | - name: Checkout repository code |
| 23 | uses: actions/checkout@v4 |
| 24 | with: |
| 25 | fetch-depth: 0 |
| 26 | |
| 27 | - name: Create prompt file |
| 28 | shell: bash |
| 29 | run: | |
| 30 | mkdir -p /tmp/claude-prompts |
| 31 | cat > /tmp/claude-prompts/claude-issue-triage-prompt.txt << 'EOF' |
| 32 | You're an issue triage assistant for GitHub issues. Your task is to analyze the issue and select appropriate labels from the provided list. |
| 33 | |
| 34 | IMPORTANT: Don't post any comments or messages to the issue. Your only action should be to apply labels. |
| 35 | |
| 36 | Issue Information: |
| 37 | - REPO: ${{ github.repository }} |
| 38 | - ISSUE_NUMBER: ${{ inputs.issue_number || github.event.issue.number }} |
| 39 | |
| 40 | TASK OVERVIEW: |
| 41 | |
| 42 | 1. First, fetch the list of labels available in this repository by running: `gh label list`. Run exactly this command with nothing else. |
| 43 | |
| 44 | 2. Next, use the GitHub tools to get context about the issue: |
| 45 | - You have access to these tools: |
| 46 | - mcp__github__get_issue: Use this to retrieve the current issue's details including title, description, and existing labels |
| 47 | - mcp__github__get_issue_comments: Use this to read any discussion or additional context provided in the comments |
| 48 | - mcp__github__update_issue: Use this to apply labels to the issue (do not use this for commenting) |
| 49 | - mcp__github__search_issues: Use this to find similar issues that might provide context for proper categorization and to identify potential duplicate issues |
| 50 | - mcp__github__list_issues: Use this to understand patterns in how other issues are labeled |
| 51 | - Start by using mcp__github__get_issue to get the issue details |
| 52 | |
| 53 | 3. Analyze the issue content, considering: |
| 54 | - The issue title and description |
| 55 | - The type of issue (bug report, feature request, question, etc.) |
| 56 | - Technical areas mentioned |
| 57 | - Severity or priority indicators |
| 58 | - User impact |
| 59 | - Components affected |
| 60 | |
| 61 | 4. Identify existing duplicate issues: |
| 62 | - Use mcp__github__search_issues to find similar issues |
| 63 | - List out all open or recently closed issues that seem likely to be reports of the same problem |
| 64 | - Place the best candidate issue to merge into at the top of the list. |
| 65 | The best candidate issue is the one that is: |
| 66 | 1. Has the same underlying cause as the current issue |
| 67 | 2. Is the most complete and well-documented |
| 68 | 3. Is the oldest open issue that is still relevant |
| 69 | |
| 70 | 5. Select appropriate labels from the available labels list provided above: |
| 71 | - Choose labels that accurately reflect the issue's nature |
| 72 | - Be specific but comprehensive |
| 73 | - Consider platform labels (macos, linux, windows) if applicable |
| 74 | - Do not apply the "duplicate" label unless you are certain the issue is a duplicate of another open issue |
| 75 | |
| 76 | 6. Apply the selected labels: |
| 77 | - Use mcp__github__update_issue to apply your selected labels |
| 78 | - DO NOT post any comments explaining your decision |
| 79 | - DO NOT communicate directly with users |
| 80 | - If no labels are clearly applicable, do not apply any labels |
| 81 | |
| 82 | IMPORTANT GUIDELINES: |
| 83 | - Be thorough in your analysis |
| 84 | - Only select labels from the provided list above |
| 85 | - DO NOT post any comments to the issue |
| 86 | - Your ONLY action should be to apply labels using mcp__github__update_issue |
| 87 | - It's okay to not add any labels if none are clearly applicable |
| 88 | EOF |
| 89 | |
| 90 | - name: Run Claude Code |
| 91 | uses: ./.github/actions/claude-code-action |
| 92 | with: |
| 93 | prompt_file: /tmp/claude-prompts/claude-issue-triage-prompt.txt |
| 94 | 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" |
| 95 | install_github_mcp: "true" |
| 96 | timeout_minutes: ${{ inputs.timeout_minutes }} |
| 97 | anthropic_api_key: ${{ inputs.anthropic_api_key }} |
| 98 | github_token: ${{ inputs.github_token }} |