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

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