Skip to content

Commit 7a9f606

Browse files
ltawfikclaude
andcommitted
Add Claude issue triage workflow
- Uses claude-code-base-action for automated issue triage - Analyzes new issues and applies appropriate labels - Uses GitHub MCP server for issue operations - Requires ANTHROPIC_API_KEY secret to be configured 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent de27b6b commit 7a9f606

File tree

1 file changed

+106
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)