Skip to content

Commit cb882a1

Browse files
authored
Merge pull request #255 from synonymdev/feat/update-claude-review
chore: Make claude review update a single comment
2 parents 4b25919 + 6507ef6 commit cb882a1

File tree

4 files changed

+68
-17
lines changed

4 files changed

+68
-17
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ jobs:
2121
runs-on: ubuntu-latest
2222
permissions:
2323
contents: read
24-
pull-requests: read
25-
issues: read
24+
pull-requests: write
25+
issues: write
2626
id-token: write
2727

2828
steps:
@@ -36,6 +36,9 @@ jobs:
3636
uses: anthropics/claude-code-action@v1
3737
with:
3838
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
39+
use_sticky_comment: true
40+
additional_permissions: |
41+
actions: read
3942
prompt: |
4043
REPO: ${{ github.repository }}
4144
PR NUMBER: ${{ github.event.pull_request.number }}
@@ -49,9 +52,7 @@ jobs:
4952
5053
Use the repository's CLAUDE.md for guidance on style and conventions. Be constructive and helpful in your feedback.
5154
52-
Use `gh pr comment` with your Bash tool to leave your review as a comment on the PR.
53-
5455
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
5556
# or https://docs.claude.com/en/docs/claude-code/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:*)"'
57+
claude_args: '--allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"'
5758

.github/workflows/claude.yml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,28 @@ on:
1212

1313
jobs:
1414
claude:
15+
# Only allow trusted actors (OWNER, MEMBER, COLLABORATOR) to trigger Claude with write permissions
1516
if: |
16-
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
17-
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
18-
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
19-
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
17+
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude') &&
18+
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association)) ||
19+
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude') &&
20+
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association)) ||
21+
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude') &&
22+
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.review.author_association)) ||
23+
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')) &&
24+
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.issue.author_association))
2025
runs-on: ubuntu-latest
2126
permissions:
22-
contents: read
23-
pull-requests: read
24-
issues: read
27+
contents: write # Allow creating branches/commits
28+
pull-requests: write # Allow pushing to PR branches
29+
issues: write # Allow updating issue comments
2530
id-token: write
26-
actions: read # Required for Claude to read CI results on PRs
31+
actions: read # Required for Claude to read CI results on PRs
2732
steps:
2833
- name: Checkout repository
2934
uses: actions/checkout@v4
3035
with:
31-
fetch-depth: 1
36+
fetch-depth: 0 # Full history for git operations
3237

3338
- name: Run Claude Code
3439
id: claude
@@ -47,4 +52,3 @@ jobs:
4752
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
4853
# or https://docs.claude.com/en/docs/claude-code/cli-reference for available options
4954
# claude_args: '--allowed-tools Bash(gh pr:*)'
50-

.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,19 @@
44
# Xcode
55
Bitkit.xcodeproj/project.xcworkspace/xcuserdata/
66
Bitkit.xcodeproj/xcuserdata/
7+
build
78

89
# Node
910
scripts/node_modules/
1011

11-
# Transaction
12+
# Transifex
1213
tx
1314

1415
# Sweetpad
1516
buildServer.json
1617

18+
# IntelliJ IDEs
19+
.idea
20+
1721
# VSCode
1822
.vscode/
19-

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,46 @@ This installs a pre-commit hook that lints Swift files with SwiftFormat.
9494
### Xcode Previews
9595

9696
Due to the Rust dependencies in the project, Xcode previews are only compatible with iOS 17 and below.
97+
98+
## Contributing
99+
100+
### AI Code Review with Claude
101+
102+
This repository has Claude Code integrated for on-demand AI assistance on issues and pull requests.
103+
104+
#### How to Use
105+
106+
Mention `@claude` in any PR comment, issue, or review to trigger Claude:
107+
108+
| Command | Description |
109+
|---------|-------------|
110+
| `@claude review` | Request a code review of the PR |
111+
| `@claude /review` | Same as above (slash command) |
112+
| `@claude review focus on security` | Review with specific focus |
113+
| `@claude explain this change` | Ask questions about the code |
114+
| `@claude fix the null pointer issue` | Request Claude to implement a fix |
115+
| `@claude /help` | Show available commands |
116+
117+
#### Notes
118+
119+
- Claude follows the project guidelines defined in `CLAUDE.md`
120+
- **Automatic reviews** run on every PR open and push (updates same comment)
121+
- **On-demand assistance** via `@claude` mentions in comments/issues
122+
- Claude can read CI results to provide context-aware feedback
123+
- For implementation requests, Claude will create commits on your branch
124+
125+
#### Example
126+
127+
```
128+
@claude review
129+
130+
Please focus on:
131+
- SwiftUI idioms and best practices
132+
- @Observable patterns and memory management (retain cycles)
133+
- Thread safety with async/await and actors
134+
```
135+
136+
## License
137+
138+
This project is licensed under the MIT License.
139+
See the [LICENSE](./LICENSE) file for more details.

0 commit comments

Comments
 (0)