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

Add automated oncall triage workflowBrowse files
Implements a GitHub Actions workflow that automatically identifies and labels critical blocking issues requiring oncall attention.

Features:
- Runs every 6 hours via cron schedule
- Fetches open issues updated in the last 3 days (5 per page to avoid context overflow)
- Orders by UPDATED_AT DESC and stops when hitting issues older than 3 days
- Evaluates each issue for bug status, engagement level (5+), and blocking severity
- Uses LLM comprehension to determine true blocking impact, not keyword matching
- Applies "oncall" label to qualifying issues via GitHub MCP tools
- Provides detailed summary including processed count, labeled issues, and close calls

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Cat Wu authored on Oct 21, 2025 parent fb9d916 · commit 113ea425ac08
1 changed file+120 -0compared with fb9d916
A.github/workflows/oncall-triage.yml
@@ -1,0 +1,120 @@
1+name: Oncall Issue Triage
2+description: Automatically identify and label critical blocking issues requiring oncall attention
3+on:
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+
12+jobs:
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: Create oncall triage prompt
25+ run: |
26+ mkdir -p /tmp/claude-prompts
27+ cat > /tmp/claude-prompts/oncall-triage-prompt.txt << 'EOF'
28+ You're an oncall triage assistant for GitHub issues. Your task is to identify critical issues that require immediate oncall attention.
29+
30+ Important: Don't post any comments or messages to the issues. Your only action should be to apply the "oncall" label to qualifying issues.
31+
32+ Repository: ${{ github.repository }}
33+
34+ Task overview:
35+ 1. Fetch all open issues updated in the last 3 days:
36+ - Use mcp__github__list_issues with:
37+ - state="open"
38+ - first=5 (fetch only 5 issues per page)
39+ - orderBy="UPDATED_AT"
40+ - direction="DESC"
41+ - This will give you the most recently updated issues first
42+ - For each page of results, check the updatedAt timestamp of each issue
43+ - Add issues updated within the last 3 days (72 hours) to your TODO list as you go
44+ - Keep paginating using the 'after' parameter until you encounter issues older than 3 days
45+ - Once you hit issues older than 3 days, you can stop fetching (no need to fetch all open issues)
46+
47+ 2. Build your TODO list incrementally as you fetch:
48+ - As you fetch each page, immediately add qualifying issues to your TODO list
49+ - One TODO item per issue number (e.g., "Evaluate issue #123")
50+ - This allows you to start processing while still fetching more pages
51+
52+ 3. For each issue in your TODO list:
53+ - Use mcp__github__get_issue to read the issue details (title, body, labels)
54+ - Use mcp__github__get_issue_comments to read all comments
55+ - Evaluate whether this issue needs the oncall label:
56+ a) Is it a bug? (has "bug" label or describes bug behavior)
57+ b) Does it have at least 5 engagements? (count comments + reactions)
58+ c) Is it truly blocking? Read and understand the full content to determine:
59+ - Does this prevent core functionality from working?
60+ - Can users work around it?
61+ - Consider severity indicators: "crash", "stuck", "frozen", "hang", "unresponsive", "cannot use", "blocked", "broken"
62+ - Be conservative - only flag issues that truly prevent users from getting work done
63+
64+ 4. For issues that meet all criteria and do not already have the "oncall" label:
65+ - Use mcp__github__update_issue to add the "oncall" label
66+ - Do not post any comments
67+ - Do not remove any existing labels
68+ - Do not remove the "oncall" label from issues that already have it
69+
70+ Important guidelines:
71+ - Use the TODO list to track your progress through ALL candidate issues
72+ - Process issues efficiently - don't read every single issue upfront, work through your TODO list systematically
73+ - Be conservative in your assessment - only flag truly critical blocking issues
74+ - Do not post any comments to issues
75+ - Your only action should be to add the "oncall" label using mcp__github__update_issue
76+ - Mark each issue as complete in your TODO list as you process it
77+
78+ 7. After processing all issues in your TODO list, provide a summary of your actions:
79+ - Total number of issues processed (candidate issues evaluated)
80+ - Number of issues that received the "oncall" label
81+ - For each issue that got the label: list issue number, title, and brief reason why it qualified
82+ - Close calls: List any issues that almost qualified but didn't quite meet the criteria (e.g., borderline blocking, had workarounds)
83+ - If no issues qualified, state that clearly
84+ - Format the summary clearly for easy reading
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__list_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 }}