Skip to content

Commit 4780996

Browse files
committed
Merge latest from upstream.
2 parents ccd0de5 + 424d1b8 commit 4780996

40 files changed

+4014
-474
lines changed

.DS_Store

-8 KB
Binary file not shown.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ""
5+
labels: bug
6+
assignees: ""
7+
---
8+
9+
**Describe the bug**
10+
A clear and concise description of what the bug is.
11+
12+
**To Reproduce**
13+
Steps to reproduce the behavior:
14+
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Screenshots**
24+
If applicable, add screenshots to help explain your problem.
25+
26+
**Workflow yml file**
27+
If it's not sensitive, consider including a paste of your full Claude workflow.yml file.
28+
29+
**API Provider**
30+
31+
[ ] Anthropic First-Party API (default)
32+
[ ] AWS Bedrock
33+
[ ] GCP Vertex
34+
35+
**Additional context**
36+
Add any other context about the problem here.

.github/workflows/claude.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,6 @@ jobs:
3434
uses: anthropics/claude-code-action@beta
3535
with:
3636
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
37+
allowed_tools: "Bash(bun install),Bash(bun test:*),Bash(bun run format),Bash(bun typecheck)"
38+
custom_instructions: "You have also been granted tools for editing files and running bun commands (install, run, test, typecheck) for testing your changes: bun install, bun test, bun run format, bun typecheck."
39+
model: "claude-opus-4-20250514"

.github/workflows/issue-triage.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: Claude Issue Triage
2+
description: Run Claude Code for issue triage in GitHub Actions
3+
on:
4+
issues:
5+
types: [opened]
6+
7+
jobs:
8+
triage-issue:
9+
runs-on: ubuntu-latest
10+
timeout-minutes: 10
11+
permissions:
12+
contents: read
13+
issues: write
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Setup GitHub MCP Server
22+
run: |
23+
mkdir -p /tmp/mcp-config
24+
cat > /tmp/mcp-config/mcp-servers.json << 'EOF'
25+
{
26+
"mcpServers": {
27+
"github": {
28+
"command": "docker",
29+
"args": [
30+
"run",
31+
"-i",
32+
"--rm",
33+
"-e",
34+
"GITHUB_PERSONAL_ACCESS_TOKEN",
35+
"ghcr.io/github/github-mcp-server:sha-7aced2b"
36+
],
37+
"env": {
38+
"GITHUB_PERSONAL_ACCESS_TOKEN": "${{ secrets.GITHUB_TOKEN }}"
39+
}
40+
}
41+
}
42+
}
43+
EOF
44+
45+
- name: Create triage prompt
46+
run: |
47+
mkdir -p /tmp/claude-prompts
48+
cat > /tmp/claude-prompts/triage-prompt.txt << 'EOF'
49+
You're an issue triage assistant for GitHub issues. Your task is to analyze the issue and select appropriate labels from the provided list.
50+
51+
IMPORTANT: Don't post any comments or messages to the issue. Your only action should be to apply labels.
52+
53+
Issue Information:
54+
- REPO: ${{ github.repository }}
55+
- ISSUE_NUMBER: ${{ github.event.issue.number }}
56+
57+
TASK OVERVIEW:
58+
59+
1. First, fetch the list of labels available in this repository by running: `gh label list`. Run exactly this command with nothing else.
60+
61+
2. Next, use the GitHub tools to get context about the issue:
62+
- You have access to these tools:
63+
- mcp__github__get_issue: Use this to retrieve the current issue's details including title, description, and existing labels
64+
- mcp__github__get_issue_comments: Use this to read any discussion or additional context provided in the comments
65+
- mcp__github__update_issue: Use this to apply labels to the issue (do not use this for commenting)
66+
- mcp__github__search_issues: Use this to find similar issues that might provide context for proper categorization and to identify potential duplicate issues
67+
- mcp__github__list_issues: Use this to understand patterns in how other issues are labeled
68+
- Start by using mcp__github__get_issue to get the issue details
69+
70+
3. Analyze the issue content, considering:
71+
- The issue title and description
72+
- The type of issue (bug report, feature request, question, etc.)
73+
- Technical areas mentioned
74+
- Severity or priority indicators
75+
- User impact
76+
- Components affected
77+
78+
4. Select appropriate labels from the available labels list provided above:
79+
- Choose labels that accurately reflect the issue's nature
80+
- Be specific but comprehensive
81+
- Select priority labels if you can determine urgency (high-priority, med-priority, or low-priority)
82+
- Consider platform labels (android, ios) if applicable
83+
- If you find similar issues using mcp__github__search_issues, consider using a "duplicate" label if appropriate. Only do so if the issue is a duplicate of another OPEN issue.
84+
85+
5. Apply the selected labels:
86+
- Use mcp__github__update_issue to apply your selected labels
87+
- DO NOT post any comments explaining your decision
88+
- DO NOT communicate directly with users
89+
- If no labels are clearly applicable, do not apply any labels
90+
91+
IMPORTANT GUIDELINES:
92+
- Be thorough in your analysis
93+
- Only select labels from the provided list above
94+
- DO NOT post any comments to the issue
95+
- Your ONLY action should be to apply labels using mcp__github__update_issue
96+
- It's okay to not add any labels if none are clearly applicable
97+
EOF
98+
99+
- name: Run Claude Code for Issue Triage
100+
uses: anthropics/claude-code-base-action@beta
101+
with:
102+
prompt_file: /tmp/claude-prompts/triage-prompt.txt
103+
allowed_tools: "Bash(gh label list),mcp__github__get_issue,mcp__github__get_issue_comments,mcp__github__update_issue,mcp__github__search_issues,mcp__github__list_issues"
104+
mcp_config: /tmp/mcp-config/mcp-servers.json
105+
timeout_minutes: "5"
106+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.DS_Store
12
node_modules
23

34
**/.claude/settings.local.json

FAQ.md

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
# Frequently Asked Questions (FAQ)
2+
3+
This FAQ addresses common questions and gotchas when using the Claude Code GitHub Action.
4+
5+
## Triggering and Authentication
6+
7+
### Why doesn't tagging @claude from my automated workflow work?
8+
9+
The `github-actions` user cannot trigger subsequent GitHub Actions workflows. This is a GitHub security feature to prevent infinite loops. To make this work, you need to use a Personal Access Token (PAT) instead, which will act as a regular user, or use a separate app token of your own. When posting a comment on an issue or PR from your workflow, use your PAT instead of the `GITHUB_TOKEN` generated in your workflow.
10+
11+
### Why does Claude say I don't have permission to trigger it?
12+
13+
Only users with **write permissions** to the repository can trigger Claude. This is a security feature to prevent unauthorized use. Make sure the user commenting has at least write access to the repository.
14+
15+
### Why am I getting OIDC authentication errors?
16+
17+
If you're using the default GitHub App authentication, you must add the `id-token: write` permission to your workflow:
18+
19+
```yaml
20+
permissions:
21+
contents: read
22+
id-token: write # Required for OIDC authentication
23+
```
24+
25+
The OIDC token is required in order for the Claude GitHub app to function. If you wish to not use the GitHub app, you can instead provide a `github_token` input to the action for Claude to operate with. See the [Claude Code permissions documentation][perms] for more.
26+
27+
## Claude's Capabilities and Limitations
28+
29+
### Why won't Claude update workflow files when I ask it to?
30+
31+
The GitHub App for Claude doesn't have workflow write access for security reasons. This prevents Claude from modifying CI/CD configurations that could potentially create unintended consequences. This is something we may reconsider in the future.
32+
33+
### Why won't Claude rebase my branch?
34+
35+
By default, Claude only uses commit tools for non-destructive changes to the branch. Claude is configured to:
36+
37+
- Never push to branches other than where it was invoked (either its own branch or the PR branch)
38+
- Never force push or perform destructive operations
39+
40+
You can grant additional tools via the `allowed_tools` input if needed:
41+
42+
```yaml
43+
allowed_tools: "Bash(git rebase:*)" # Use with caution
44+
```
45+
46+
### Why won't Claude create a pull request?
47+
48+
Claude doesn't create PRs by default. Instead, it pushes commits to a branch and provides a link to a pre-filled PR submission page. This approach ensures your repository's branch protection rules are still adhered to and gives you final control over PR creation.
49+
50+
### Why can't Claude run my tests or see CI results?
51+
52+
Claude cannot access GitHub Actions logs, test results, or other CI/CD outputs by default. It only has access to the repository files. If you need Claude to see test results, you can either:
53+
54+
1. Instruct Claude to run tests before making commits
55+
2. Copy and paste CI results into a comment for Claude to analyze
56+
57+
This limitation exists for security reasons but may be reconsidered in the future based on user feedback.
58+
59+
### Why does Claude only update one comment instead of creating new ones?
60+
61+
Claude is configured to update a single comment to avoid cluttering PR/issue discussions. All of Claude's responses, including progress updates and final results, will appear in the same comment with checkboxes showing task progress.
62+
63+
## Branch and Commit Behavior
64+
65+
### Why did Claude create a new branch when commenting on a closed PR?
66+
67+
Claude's branch behavior depends on the context:
68+
69+
- **Open PRs**: Pushes directly to the existing PR branch
70+
- **Closed/Merged PRs**: Creates a new branch (cannot push to closed PR branches)
71+
- **Issues**: Always creates a new branch with a timestamp
72+
73+
### Why are my commits shallow/missing history?
74+
75+
For performance, Claude uses shallow clones:
76+
77+
- PRs: `--depth=20` (last 20 commits)
78+
- New branches: `--depth=1` (single commit)
79+
80+
If you need full history, you can configure this in your workflow before calling Claude in the `actions/checkout` step.
81+
82+
```
83+
- uses: actions/checkout@v4
84+
depth: 0 # will fetch full repo history
85+
```
86+
87+
## Configuration and Tools
88+
89+
### What's the difference between `direct_prompt` and `custom_instructions`?
90+
91+
These inputs serve different purposes in how Claude responds:
92+
93+
- **`direct_prompt`**: Bypasses trigger detection entirely. When provided, Claude executes this exact instruction regardless of comments or mentions. Perfect for automated workflows where you want Claude to perform a specific task on every run (e.g., "Update the API documentation based on changes in this PR").
94+
95+
- **`custom_instructions`**: Additional context added to Claude's system prompt while still respecting normal triggers. These instructions modify Claude's behavior but don't replace the triggering comment. Use this to give Claude standing instructions like "You have been granted additional tools for ...".
96+
97+
Example:
98+
99+
```yaml
100+
# Using direct_prompt - runs automatically without @claude mention
101+
direct_prompt: "Review this PR for security vulnerabilities"
102+
103+
# Using custom_instructions - still requires @claude trigger
104+
custom_instructions: "Focus on performance implications and suggest optimizations"
105+
```
106+
107+
### Why doesn't Claude execute my bash commands?
108+
109+
The Bash tool is **disabled by default** for security. To enable individual bash commands:
110+
111+
```yaml
112+
allowed_tools: "Bash(npm:*),Bash(git:*)" # Allows only npm and git commands
113+
```
114+
115+
### Can Claude work across multiple repositories?
116+
117+
No, Claude's GitHub app token is sandboxed to the current repository only. It cannot push to any other repositories. It can, however, read public repositories, but to get access to this, you must configure it with tools to do so.
118+
119+
## MCP Servers and Extended Functionality
120+
121+
### What MCP servers are available by default?
122+
123+
Claude Code Action automatically configures two MCP servers:
124+
125+
1. **GitHub MCP server**: For GitHub API operations
126+
2. **File operations server**: For advanced file manipulation
127+
128+
However, tools from these servers still need to be explicitly allowed via `allowed_tools`.
129+
130+
## Troubleshooting
131+
132+
### How can I debug what Claude is doing?
133+
134+
Check the GitHub Action log for Claude's run for the full execution trace.
135+
136+
### Why can't I trigger Claude with `@claude-mention` or `claude!`?
137+
138+
The trigger uses word boundaries, so `@claude` must be a complete word. Variations like `@claude-bot`, `@claude!`, or `claude@mention` won't work unless you customize the `trigger_phrase`.
139+
140+
## Best Practices
141+
142+
1. **Always specify permissions explicitly** in your workflow file
143+
2. **Use GitHub Secrets** for API keys - never hardcode them
144+
3. **Be specific with `allowed_tools`** - only enable what's necessary
145+
4. **Test in a separate branch** before using on important PRs
146+
5. **Monitor Claude's token usage** to avoid hitting API limits
147+
6. **Review Claude's changes** carefully before merging
148+
149+
## Getting Help
150+
151+
If you encounter issues not covered here:
152+
153+
1. Check the [GitHub Issues](https://github.com/anthropics/claude-code-action/issues)
154+
2. Review the [example workflows](https://github.com/anthropics/claude-code-action#examples)
155+
156+
[perms]: https://docs.anthropic.com/en/docs/claude-code/settings#permissions

0 commit comments

Comments
 (0)