Skip to content

Commit 5014b78

Browse files
authored
1 parent 3dfa0a3 commit 5014b78

File tree

1 file changed

+29
-13
lines changed

1 file changed

+29
-13
lines changed

.github/workflows/claude.yml

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
name: Claude PR Comment Review
2+
# https://github.com/anthropics/claude-code-action/blob/main/docs/solutions.md#automatic-pr-code-review
3+
# https://skywork.ai/blog/how-to-use-claude-code-for-prs-code-reviews-guide/#step-3-add-a-comment-triggered-workflow-copy-pasteable
24

35
on:
46
issue_comment:
57
types: [created]
68
pull_request_review_comment:
79
types: [created]
810

9-
permissions:
10-
contents: read
11-
pull-requests: write
1211

1312
jobs:
1413
review:
@@ -18,19 +17,36 @@ jobs:
1817
&& (github.event.issue.pull_request != null || github.event.pull_request != null) }
1918
}
2019
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
22+
pull-requests: write
23+
id-token: write
2124
steps:
22-
- name: Checkout
23-
uses: actions/checkout@v4
25+
- uses: actions/checkout@v5
26+
with:
27+
fetch-depth: 1
2428

25-
- name: Run Claude Code Action (comment-triggered)
26-
uses: anthropics/claude-code-action@v1
29+
- uses: anthropics/claude-code-action@v1
2730
with:
2831
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
32+
track_progress: true # ✨ Enables tracking comments
2933
prompt: |
30-
You are reviewing a GitHub pull request. Focus on security, correctness, and clarity.
31-
- Only comment on files that changed in this PR.
32-
- Prioritize actionable fixes and cite specific lines.
33-
- Check consistency with existing code style.
34-
- Skip style issues already handled by linters.
35-
- Search the codebase for code that could be reused in this PR.
34+
REPO: ${{ github.repository }}
35+
PR NUMBER: ${{ github.event.pull_request.number }}
36+
37+
Please review this pull request checked out in the current working directory with a focus on:
38+
- Code quality and best practices
39+
- Potential bugs or issues
40+
- Security implications
41+
- Performance considerations
42+
43+
Make sure to:
44+
- Use `gh pr comment` for top-level feedback.
45+
- Use `mcp__github_inline_comment__create_inline_comment` to highlight specific code issues.
46+
- Check consistency with existing code style
47+
- Search the repository for code that could be reused in this PR
48+
- Skip style issues already handled by linters.
3649
- Respond in concise bullet point form; avoid restating code.
50+
51+
claude_args: |
52+
--allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)"

0 commit comments

Comments
 (0)