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