Skip to content

Commit 432e693

Browse files
authored
Add Claude Code GitHub Workflow (#23)
* "Update Claude PR Assistant workflow" * "Update Claude Code Review workflow"
1 parent 4ce425d commit 432e693

File tree

2 files changed

+42
-38
lines changed

2 files changed

+42
-38
lines changed

.github/workflows/claude-code-review.yml

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,48 +3,55 @@ name: Claude Code Review
33
on:
44
pull_request:
55
types: [opened, synchronize]
6+
# Optional: Only run on specific file changes
7+
# paths:
8+
# - "src/**/*.ts"
9+
# - "src/**/*.tsx"
10+
# - "src/**/*.js"
11+
# - "src/**/*.jsx"
612

713
jobs:
814
claude-review:
15+
# Optional: Filter by PR author
16+
# if: |
17+
# github.event.pull_request.user.login == 'external-contributor' ||
18+
# github.event.pull_request.user.login == 'new-developer' ||
19+
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
20+
921
runs-on: ubuntu-latest
1022
permissions:
1123
contents: read
12-
pull-requests: write
24+
pull-requests: read
1325
issues: read
1426
id-token: write
1527

1628
steps:
1729
- name: Checkout repository
1830
uses: actions/checkout@v4
1931
with:
20-
fetch-depth: 0
32+
fetch-depth: 1
2133

2234
- name: Run Claude Code Review
2335
id: claude-review
2436
uses: anthropics/claude-code-action@v1
2537
with:
2638
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
2739
prompt: |
28-
Review PR #${{ github.event.pull_request.number }} in ${{ github.repository }}.
29-
30-
This is an MCP (Model Context Protocol) server for the Coolify API. Focus on:
31-
32-
**Critical Issues:**
33-
- Security vulnerabilities (exposed tokens, injection attacks, unsafe data handling)
34-
- Breaking changes to the MCP tool interface
35-
- Bugs that would cause runtime errors
40+
REPO: ${{ github.repository }}
41+
PR NUMBER: ${{ github.event.pull_request.number }}
3642
37-
**Code Quality:**
38-
- TypeScript type safety - ensure proper typing, avoid `any`
39-
- Error handling - all API calls should have proper error handling
40-
- Consistency with existing patterns in coolify-client.ts and mcp-server.ts
43+
Please review this pull request and provide feedback on:
44+
- Code quality and best practices
45+
- Potential bugs or issues
46+
- Performance considerations
47+
- Security concerns
48+
- Test coverage
4149
42-
**Testing:**
43-
- New functionality should have corresponding tests
44-
- Tests should cover edge cases and error conditions
50+
Use the repository's CLAUDE.md for guidance on style and conventions. Be constructive and helpful in your feedback.
4551
46-
Keep feedback concise and actionable. Skip minor style issues that Prettier/ESLint will catch.
52+
Use `gh pr comment` with your Bash tool to leave your review as a comment on the PR.
4753
48-
Use `gh pr comment` to post your review. If no critical issues, say "✅ LGTM - No critical issues found."
54+
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
55+
# or https://code.claude.com/docs/en/cli-reference for available options
56+
claude_args: '--allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"'
4957

50-
claude_args: '--allowed-tools "Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Read,Glob,Grep"'

.github/workflows/claude.yml

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,35 +19,32 @@ jobs:
1919
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
2020
runs-on: ubuntu-latest
2121
permissions:
22-
contents: write
23-
pull-requests: write
24-
issues: write
22+
contents: read
23+
pull-requests: read
24+
issues: read
2525
id-token: write
26-
actions: read
27-
26+
actions: read # Required for Claude to read CI results on PRs
2827
steps:
2928
- name: Checkout repository
3029
uses: actions/checkout@v4
3130
with:
32-
fetch-depth: 0
33-
token: ${{ secrets.GITHUB_TOKEN }}
34-
35-
- name: Setup Node.js
36-
uses: actions/setup-node@v4
37-
with:
38-
node-version: '20.x'
39-
cache: 'npm'
40-
41-
- name: Install dependencies
42-
run: npm ci
31+
fetch-depth: 1
4332

4433
- name: Run Claude Code
4534
id: claude
4635
uses: anthropics/claude-code-action@v1
4736
with:
4837
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
38+
39+
# This is an optional setting that allows Claude to read CI results on PRs
4940
additional_permissions: |
5041
actions: read
5142
52-
# Allow Claude to use all tools for flexibility
53-
claude_args: '--allowed-tools "*"'
43+
# Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
44+
# prompt: 'Update the pull request description to include a summary of changes.'
45+
46+
# Optional: Add claude_args to customize behavior and configuration
47+
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
48+
# or https://code.claude.com/docs/en/cli-reference for available options
49+
# claude_args: '--allowed-tools Bash(gh pr:*)'
50+

0 commit comments

Comments
 (0)