Skip to content

Commit e94e216

Browse files
authored
Merge pull request #2832 from ClickHouse/claude-review-gha
Add GitHub Action for Claude integration
2 parents cd9b60d + 10b744c commit e94e216

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

.github/workflows/claude.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Claude Code
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
pull_request_review_comment:
7+
types: [created]
8+
issues:
9+
types: [opened, assigned]
10+
pull_request_review:
11+
types: [submitted]
12+
13+
jobs:
14+
claude:
15+
if: |
16+
github.event.sender.type != 'Bot' &&
17+
(
18+
contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association) ||
19+
contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.review.author_association) ||
20+
contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.issue.author_association)
21+
) &&
22+
(
23+
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
24+
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
25+
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
26+
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
27+
)
28+
runs-on: ubuntu-latest
29+
permissions:
30+
contents: write
31+
pull-requests: write
32+
issues: write
33+
id-token: write
34+
actions: read # Required for Claude to read CI results on PRs
35+
steps:
36+
- name: Checkout repository
37+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
38+
with:
39+
fetch-depth: 1
40+
41+
- name: Run Claude Code
42+
id: claude
43+
uses: anthropics/claude-code-action@b47fd721da662d48c5680e154ad16a73ed74d2e0 # v1
44+
with:
45+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
46+
47+
# This is an optional setting that allows Claude to read CI results on PRs
48+
additional_permissions: |
49+
actions: read
50+
51+
# Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
52+
# prompt: 'Update the pull request description to include a summary of changes.'
53+
54+
# Optional: Add claude_args to customize behavior and configuration
55+
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
56+
# or https://code.claude.com/docs/en/cli-reference for available options
57+
# claude_args: '--allowed-tools Bash(gh pr:*)'

0 commit comments

Comments
 (0)