Skip to content

Commit 5feb4a1

Browse files
8bitAlexCopilot
andauthored
Add Claude Code GitHub Workflow (#4)
* "Claude PR Assistant workflow" * "Claude Code Review workflow" * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent c2b7908 commit 5feb4a1

2 files changed

Lines changed: 126 additions & 0 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Claude Code Review
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, ready_for_review, reopened]
6+
# Optional: Only run on specific file changes
7+
# paths:
8+
# - "src/**/*.ts"
9+
# - "src/**/*.tsx"
10+
# - "src/**/*.js"
11+
# - "src/**/*.jsx"
12+
13+
jobs:
14+
claude-review:
15+
if: ${{ github.event.pull_request.head.repo.fork == false && secrets.CLAUDE_CODE_OAUTH_TOKEN != '' }}
16+
# Optional: Filter by PR author
17+
# if: |
18+
# github.event.pull_request.user.login == 'external-contributor' ||
19+
# github.event.pull_request.user.login == 'new-developer' ||
20+
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
21+
22+
runs-on: ubuntu-latest
23+
permissions:
24+
contents: read
25+
pull-requests: write
26+
issues: write
27+
id-token: write
28+
29+
steps:
30+
- name: Checkout repository
31+
uses: actions/checkout@v4
32+
with:
33+
fetch-depth: 1
34+
35+
- name: Run Claude Code Review
36+
id: claude-review
37+
uses: anthropics/claude-code-action@v1
38+
with:
39+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
40+
plugin_marketplaces: 'https://github.com/anthropics/claude-code.git'
41+
plugins: 'code-review@claude-code-plugins'
42+
prompt: '/code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number }}'
43+
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
44+
# or https://code.claude.com/docs/en/cli-reference for available options
45+

.github/workflows/claude.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
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+
(
17+
github.event_name == 'issue_comment' &&
18+
contains(github.event.comment.body, '@claude') &&
19+
(
20+
github.event.comment.author_association == 'OWNER' ||
21+
github.event.comment.author_association == 'MEMBER' ||
22+
github.event.comment.author_association == 'COLLABORATOR'
23+
)
24+
) ||
25+
(
26+
github.event_name == 'pull_request_review_comment' &&
27+
contains(github.event.comment.body, '@claude') &&
28+
(
29+
github.event.comment.author_association == 'OWNER' ||
30+
github.event.comment.author_association == 'MEMBER' ||
31+
github.event.comment.author_association == 'COLLABORATOR'
32+
)
33+
) ||
34+
(
35+
github.event_name == 'pull_request_review' &&
36+
contains(github.event.review.body, '@claude') &&
37+
(
38+
github.event.review.author_association == 'OWNER' ||
39+
github.event.review.author_association == 'MEMBER' ||
40+
github.event.review.author_association == 'COLLABORATOR'
41+
)
42+
) ||
43+
(
44+
github.event_name == 'issues' &&
45+
(
46+
contains(github.event.issue.body, '@claude') ||
47+
contains(github.event.issue.title, '@claude')
48+
) &&
49+
(
50+
github.event.issue.author_association == 'OWNER' ||
51+
github.event.issue.author_association == 'MEMBER' ||
52+
github.event.issue.author_association == 'COLLABORATOR'
53+
)
54+
)
55+
runs-on: ubuntu-latest
56+
permissions:
57+
contents: write
58+
pull-requests: write
59+
issues: write
60+
id-token: write
61+
actions: read # Required for Claude to read CI results on PRs
62+
steps:
63+
- name: Checkout repository
64+
uses: actions/checkout@v4
65+
with:
66+
fetch-depth: 1
67+
68+
- name: Run Claude Code
69+
id: claude
70+
uses: anthropics/claude-code-action@v1
71+
with:
72+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
73+
74+
# Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
75+
# prompt: 'Update the pull request description to include a summary of changes.'
76+
77+
# Optional: Add claude_args to customize behavior and configuration
78+
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
79+
# or https://code.claude.com/docs/en/cli-reference for available options
80+
# claude_args: '--allowed-tools Bash(gh pr:*)'
81+

0 commit comments

Comments
 (0)