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

Refactor: Process only recent issues to improve performanceBrowse files
Changes the workflow to be event-driven and process fewer issues:
- Triggers on issue events (opened, edited, labeled, reopened) and comments
- When triggered by event, processes only that specific issue
- When running on schedule, only checks issues created in last 7 days
- Only adds oncall label, never removes it
- Uses search_issues instead of list_issues for better filtering

This dramatically reduces the dataset size and makes the workflow
more efficient and scalable.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Claude authored on Oct 20, 2025 parent d5e4871 · commit d678ba9059d8
1 changed file+20 -12compared with d5e4871
M.github/workflows/claude-oncall-triage.yml
@@ -1,15 +1,19 @@
11 name: Claude Oncall Issue Triage
22 description: Identify critical issues that require oncall attention
33 on:
4+ issues:
5+ types: [opened, edited, labeled, reopened]
6+ issue_comment:
7+ types: [created]
48 schedule:
5- # Run every 6 hours
9+ # Run every 6 hours to catch issues that recently crossed the threshold
610 - cron: '0 */6 * * *'
711 workflow_dispatch: # Allow manual trigger
812
913 jobs:
1014 oncall-triage:
1115 runs-on: ubuntu-latest
12- timeout-minutes: 15
16+ timeout-minutes: 10
1317 permissions:
1418 contents: read
1519 issues: write
@@ -27,15 +31,20 @@
2731 IMPORTANT: Don't post any comments or messages to the issues. Your only action should be to apply the "oncall" label to qualifying issues.
2832
2933 Repository: ${{ github.repository }}
34+ Triggered by: ${{ github.event_name }}
35+ Issue number (if triggered by issue event): ${{ github.event.issue.number }}
3036
3137 TASK OVERVIEW:
3238
33- 1. Use mcp__github__list_issues to get all open issues in the repository.
39+ 1. Determine which issues to process:
40+ - If this workflow was triggered by an issue event (issue number provided above), process ONLY that issue
41+ - 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)")
42+ - This keeps the dataset small and focused on recent activity
3443
35- 2. For each issue, gather the following information using the GitHub MCP tools:
44+ 2. For each issue to process, gather information using GitHub MCP tools:
3645 - Issue details (title, body, labels) using mcp__github__get_issue
3746 - All comments using mcp__github__get_issue_comments
38- - Reaction counts from the issue data (available in the reactionGroups field)
47+ - Reaction counts from the reactionGroups field
3948
4049 3. Evaluate each issue against the oncall criteria. An issue is oncall-worthy if ALL of the following are true:
4150
@@ -58,21 +67,20 @@
5867 - Count total number of comments
5968 - Sum must be >= 5
6069
61- 4. For issues that meet ALL criteria above:
70+ 4. For issues that meet ALL criteria above AND don't already have the "oncall" label:
6271 - Use mcp__github__update_issue to add the "oncall" label
6372 - DO NOT post any comments
6473 - DO NOT remove any existing labels
6574
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
75+ 5. Do NOT remove the "oncall" label from any issues
6976
7077 IMPORTANT GUIDELINES:
7178 - Be conservative in your assessment - only flag truly critical blocking issues
7279 - ALL four criteria must be met for an issue to receive the "oncall" label
7380 - 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
81+ - Your ONLY action should be to apply the "oncall" label using mcp__github__update_issue
82+ - Only add the label, never remove it
83+ - Process efficiently - only check recent issues (last 7 days) when running on schedule
7684 EOF
7785
7886 - name: Setup GitHub MCP Server
@@ -103,7 +111,7 @@
103111 uses: anthropics/claude-code-base-action@beta
104112 with:
105113 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"
114+ allowed_tools: "mcp__github__search_issues,mcp__github__get_issue,mcp__github__get_issue_comments,mcp__github__update_issue"
107115 timeout_minutes: "10"
108116 anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
109117 mcp_config: /tmp/mcp-config/mcp-servers.json