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
Creates a new scheduled workflow that identifies critical issues requiring oncall attention based on: - Must be a bug - Must be blocking users from using Claude Code - Last activity within 3 days - At least 5 engagements (reactions + comments) The workflow runs every 6 hours and applies/removes the "oncall" label automatically. ๐ค Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
| @@ -1,0 +1,111 @@ | ||
| 1 | +name: Claude Oncall Issue Triage | |
| 2 | +description: Identify critical issues that require oncall attention | |
| 3 | +on: | |
| 4 | + schedule: | |
| 5 | + # Run every 6 hours | |
| 6 | + - cron: '0 */6 * * *' | |
| 7 | + workflow_dispatch: # Allow manual trigger | |
| 8 | + | |
| 9 | +jobs: | |
| 10 | + oncall-triage: | |
| 11 | + runs-on: ubuntu-latest | |
| 12 | + timeout-minutes: 15 | |
| 13 | + permissions: | |
| 14 | + contents: read | |
| 15 | + issues: write | |
| 16 | + | |
| 17 | + steps: | |
| 18 | + - name: Checkout repository | |
| 19 | + uses: actions/checkout@v4 | |
| 20 | + | |
| 21 | + - name: Create oncall triage prompt | |
| 22 | + run: | | |
| 23 | + mkdir -p /tmp/claude-prompts | |
| 24 | + cat > /tmp/claude-prompts/oncall-triage-prompt.txt << 'EOF' | |
| 25 | + You're an oncall triage assistant for GitHub issues. Your task is to identify critical issues that require immediate oncall attention. | |
| 26 | + | |
| 27 | + IMPORTANT: Don't post any comments or messages to the issues. Your only action should be to apply the "oncall" label to qualifying issues. | |
| 28 | + | |
| 29 | + Repository: ${{ github.repository }} | |
| 30 | + | |
| 31 | + TASK OVERVIEW: | |
| 32 | + | |
| 33 | + 1. Use mcp__github__list_issues to get all open issues in the repository. | |
| 34 | + | |
| 35 | + 2. For each issue, gather the following information using the GitHub MCP tools: | |
| 36 | + - Issue details (title, body, labels) using mcp__github__get_issue | |
| 37 | + - All comments using mcp__github__get_issue_comments | |
| 38 | + - Reaction counts from the issue data | |
| 39 | + | |
| 40 | + 3. Evaluate each issue against the oncall criteria. An issue is oncall-worthy if ALL of the following are true: | |
| 41 | + | |
| 42 | + a) Must be a bug: | |
| 43 | + - The issue has a "bug" label OR | |
| 44 | + - The issue content clearly describes a bug (error, crash, unexpected behavior) | |
| 45 | + | |
| 46 | + b) Must be blocking users from using Claude Code: | |
| 47 | + - Look for keywords indicating severity: "crash", "stuck", "frozen", "hang", "unresponsive", "cannot use", "blocked", "broken" | |
| 48 | + - The issue prevents core functionality from working | |
| 49 | + - Users cannot work around the issue | |
| 50 | + | |
| 51 | + c) Last activity is within the last 3 days: | |
| 52 | + - Check the issue's updated_at timestamp | |
| 53 | + - Calculate if it was updated within the last 72 hours from now | |
| 54 | + - Activity includes: new comments, reactions, or label changes | |
| 55 | + | |
| 56 | + d) At least 5 engagements: | |
| 57 | + - Count total reactions on the issue (๐, โค๏ธ, ๐, ๐, ๐, ๐, etc.) | |
| 58 | + - Count total number of comments | |
| 59 | + - Sum must be >= 5 | |
| 60 | + | |
| 61 | + 4. For issues that meet ALL criteria above: | |
| 62 | + - Use mcp__github__update_issue to add the "oncall" label | |
| 63 | + - DO NOT post any comments | |
| 64 | + - DO NOT remove any existing labels | |
| 65 | + | |
| 66 | + 5. For issues that already have the "oncall" label but NO LONGER meet the criteria: | |
| 67 | + - Use mcp__github__update_issue to remove the "oncall" label | |
| 68 | + - This keeps the oncall board current | |
| 69 | + | |
| 70 | + IMPORTANT GUIDELINES: | |
| 71 | + - Be conservative in your assessment - only flag truly critical blocking issues | |
| 72 | + - ALL four criteria must be met for an issue to receive the "oncall" label | |
| 73 | + - DO NOT post any comments to issues | |
| 74 | + - Your ONLY action should be to apply or remove the "oncall" label using mcp__github__update_issue | |
| 75 | + - Process issues systematically and thoroughly | |
| 76 | + EOF | |
| 77 | + | |
| 78 | + - name: Setup GitHub MCP Server | |
| 79 | + run: | | |
| 80 | + mkdir -p /tmp/mcp-config | |
| 81 | + cat > /tmp/mcp-config/mcp-servers.json << 'EOF' | |
| 82 | + { | |
| 83 | + "mcpServers": { | |
| 84 | + "github": { | |
| 85 | + "command": "docker", | |
| 86 | + "args": [ | |
| 87 | + "run", | |
| 88 | + "-i", | |
| 89 | + "--rm", | |
| 90 | + "-e", | |
| 91 | + "GITHUB_PERSONAL_ACCESS_TOKEN", | |
| 92 | + "ghcr.io/github/github-mcp-server:sha-7aced2b" | |
| 93 | + ], | |
| 94 | + "env": { | |
| 95 | + "GITHUB_PERSONAL_ACCESS_TOKEN": "${{ secrets.GITHUB_TOKEN }}" | |
| 96 | + } | |
| 97 | + } | |
| 98 | + } | |
| 99 | + } | |
| 100 | + EOF | |
| 101 | + | |
| 102 | + - name: Run Claude Code for Oncall Triage | |
| 103 | + uses: anthropics/claude-code-base-action@beta | |
| 104 | + with: | |
| 105 | + prompt_file: /tmp/claude-prompts/oncall-triage-prompt.txt | |
| 106 | + allowed_tools: "mcp__github__list_issues,mcp__github__get_issue,mcp__github__get_issue_comments,mcp__github__update_issue" | |
| 107 | + timeout_minutes: "10" | |
| 108 | + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} | |
| 109 | + mcp_config: /tmp/mcp-config/mcp-servers.json | |
| 110 | + claude_env: | | |
| 111 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |