Skip to content

Commit c0e75c9

Browse files
haukeclaude
andcommitted
github: add Claude code review workflow triggered by /claude comment
Add claude-code-review.yml using anthropics/claude-code-action@v1. The review runs when a PR comment containing "/claude" is posted, avoiding unnecessary API usage on every push. Uses issue_comment trigger restricted to PR comments only. Only triggers for users with write access (OWNER, MEMBER, COLLABORATOR) and when the comment body contains "/claude", preventing any runner from being allocated for unrelated comments. A short domain hint steers the review toward OpenWrt embedded Linux conventions. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Link: openwrt#22556 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
1 parent adc1406 commit c0e75c9

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Claude Code Review
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
7+
permissions:
8+
contents: read
9+
pull-requests: write
10+
11+
jobs:
12+
code-review:
13+
name: Claude Code Review
14+
# Only run on PR comments containing "/claude" from users with write access
15+
if: >-
16+
github.event.issue.pull_request &&
17+
contains(github.event.comment.body, '/claude') &&
18+
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'),
19+
github.event.comment.author_association)
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
24+
with:
25+
fetch-depth: 1
26+
27+
- name: PR Review
28+
uses: anthropics/claude-code-action@6062f3709600659be5e47fcddf2cf76993c235c2 # v1
29+
with:
30+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
31+
github_token: ${{ secrets.GITHUB_TOKEN }}
32+
trigger_phrase: "/claude"
33+
prompt: >-
34+
Review this PR for an OpenWrt embedded Linux project,
35+
focusing on correctness, security, and coding conventions.
36+
claude_args: >-
37+
--allowedTools
38+
"mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)"

0 commit comments

Comments
 (0)