spacehub

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

claude-code / .github / workflows / oncall-triage.yml
115 lines · 5.5 KBRaw
1name: Oncall Issue Triage
2description: Automatically identify and label critical blocking issues requiring oncall attention
3on:
4 push:
5 branches:
6 - add-oncall-triage-workflow # Temporary: for testing only
7 schedule:
8 # Run every 6 hours
9 - cron: '0 */6 * * *'
10 workflow_dispatch: # Allow manual trigger
11
12jobs:
13 oncall-triage:
14 runs-on: ubuntu-latest
15 timeout-minutes: 15
16 permissions:
17 contents: read
18 issues: write
19
20 steps:
21 - name: Checkout repository
22 uses: actions/checkout@v4
23
24 - name: Setup GitHub MCP Server
25 run: |
26 mkdir -p /tmp/mcp-config
27 cat > /tmp/mcp-config/mcp-servers.json << 'EOF'
28 {
29 "mcpServers": {
30 "github": {
31 "command": "docker",
32 "args": [
33 "run",
34 "-i",
35 "--rm",
36 "-e",
37 "GITHUB_PERSONAL_ACCESS_TOKEN",
38 "ghcr.io/github/github-mcp-server:sha-7aced2b"
39 ],
40 "env": {
41 "GITHUB_PERSONAL_ACCESS_TOKEN": "${{ secrets.GITHUB_TOKEN }}"
42 }
43 }
44 }
45 }
46 EOF
47
48 - name: Run Claude Code for Oncall Triage
49 timeout-minutes: 10
50 uses: anthropics/claude-code-action@v1
51 env:
52 GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53 with:
54 prompt: |
55 You're an oncall triage assistant for GitHub issues. Your task is to identify critical issues that require immediate oncall attention.
56
57 Important: Don't post any comments or messages to the issues. Your only action should be to apply the "oncall" label to qualifying issues.
58
59 Repository: ${{ github.repository }}
60
61 Task overview:
62 1. Fetch all open issues updated in the last 3 days:
63 - Use mcp__github__list_issues with:
64 - state="open"
65 - first=5 (fetch only 5 issues per page)
66 - orderBy="UPDATED_AT"
67 - direction="DESC"
68 - This will give you the most recently updated issues first
69 - For each page of results, check the updatedAt timestamp of each issue
70 - Add issues updated within the last 3 days (72 hours) to your TODO list as you go
71 - Keep paginating using the 'after' parameter until you encounter issues older than 3 days
72 - Once you hit issues older than 3 days, you can stop fetching (no need to fetch all open issues)
73
74 2. Build your TODO list incrementally as you fetch:
75 - As you fetch each page, immediately add qualifying issues to your TODO list
76 - One TODO item per issue number (e.g., "Evaluate issue #123")
77 - This allows you to start processing while still fetching more pages
78
79 3. For each issue in your TODO list:
80 - Use mcp__github__get_issue to read the issue details (title, body, labels)
81 - Use mcp__github__get_issue_comments to read all comments
82 - Evaluate whether this issue needs the oncall label:
83 a) Is it a bug? (has "bug" label or describes bug behavior)
84 b) Does it have at least 50 engagements? (count comments + reactions)
85 c) Is it truly blocking? Read and understand the full content to determine:
86 - Does this prevent core functionality from working?
87 - Can users work around it?
88 - Consider severity indicators: "crash", "stuck", "frozen", "hang", "unresponsive", "cannot use", "blocked", "broken"
89 - Be conservative - only flag issues that truly prevent users from getting work done
90
91 4. For issues that meet all criteria and do not already have the "oncall" label:
92 - Use mcp__github__update_issue to add the "oncall" label
93 - Do not post any comments
94 - Do not remove any existing labels
95 - Do not remove the "oncall" label from issues that already have it
96
97 Important guidelines:
98 - Use the TODO list to track your progress through ALL candidate issues
99 - Process issues efficiently - don't read every single issue upfront, work through your TODO list systematically
100 - Be conservative in your assessment - only flag truly critical blocking issues
101 - Do not post any comments to issues
102 - Your only action should be to add the "oncall" label using mcp__github__update_issue
103 - Mark each issue as complete in your TODO list as you process it
104
105 7. After processing all issues in your TODO list, provide a summary of your actions:
106 - Total number of issues processed (candidate issues evaluated)
107 - Number of issues that received the "oncall" label
108 - For each issue that got the label: list issue number, title, and brief reason why it qualified
109 - Close calls: List any issues that almost qualified but didn't quite meet the criteria (e.g., borderline blocking, had workarounds)
110 - If no issues qualified, state that clearly
111 - Format the summary clearly for easy reading
112 anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
113 claude_args: |
114 --mcp-config /tmp/mcp-config/mcp-servers.json
115 --allowedTools "mcp__github__list_issues,mcp__github__get_issue,mcp__github__get_issue_comments,mcp__github__update_issue"