Skip to content

Commit d93a4bd

Browse files
authored
Merge pull request #47 from synonymdev/add-claude-github-actions-1771254764785
feat: add Claude Code GitHub workflow
2 parents cda6400 + 35de0c2 commit d93a4bd

3 files changed

Lines changed: 106 additions & 1 deletion

File tree

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Claude Code Review
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, ready_for_review, reopened]
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
9+
cancel-in-progress: true
10+
11+
jobs:
12+
claude-review:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
pull-requests: write
17+
issues: write
18+
id-token: write
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 1
25+
26+
- name: Minimize old Claude comments
27+
uses: actions/github-script@v7
28+
with:
29+
script: |
30+
const { data: comments } = await github.rest.issues.listComments({
31+
owner: context.repo.owner,
32+
repo: context.repo.repo,
33+
issue_number: context.payload.pull_request.number,
34+
per_page: 100,
35+
});
36+
const claudeComments = comments.filter(c =>
37+
c.user?.login === 'claude[bot]' || c.user?.login === 'github-actions[bot]'
38+
);
39+
for (const comment of claudeComments) {
40+
await github.graphql(`
41+
mutation MinimizeComment($id: ID!) {
42+
minimizeComment(input: { subjectId: $id, classifier: OUTDATED }) {
43+
minimizedComment { isMinimized }
44+
}
45+
}
46+
`, { id: comment.node_id });
47+
}
48+
49+
- name: Run Claude Code Review
50+
id: claude-review
51+
uses: anthropics/claude-code-action@v1
52+
with:
53+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
54+
plugin_marketplaces: 'https://github.com/anthropics/claude-code.git'
55+
plugins: 'code-review@claude-code-plugins'
56+
prompt: '/code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number }}'
57+
allowed_bots: 'claude[bot]'
58+
claude_args: '--allowed-tools Bash(gh:*) WebFetch'

.github/workflows/claude.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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_name == 'issue_comment' && contains(github.event.comment.body, '@claude') &&
17+
(github.event.comment.author_association == 'OWNER' || github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'COLLABORATOR')) ||
18+
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude') &&
19+
(github.event.comment.author_association == 'OWNER' || github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'COLLABORATOR')) ||
20+
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude') &&
21+
(github.event.review.author_association == 'OWNER' || github.event.review.author_association == 'MEMBER' || github.event.review.author_association == 'COLLABORATOR')) ||
22+
(github.event_name == 'issues' &&
23+
(contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')) &&
24+
(github.event.issue.author_association == 'OWNER' || github.event.issue.author_association == 'MEMBER' || github.event.issue.author_association == 'COLLABORATOR'))
25+
runs-on: ubuntu-latest
26+
permissions:
27+
contents: write
28+
pull-requests: write
29+
issues: write
30+
id-token: write
31+
actions: read
32+
steps:
33+
- name: Checkout repository
34+
uses: actions/checkout@v4
35+
with:
36+
fetch-depth: 0
37+
38+
- name: Run Claude Code
39+
id: claude
40+
uses: anthropics/claude-code-action@v1
41+
with:
42+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
43+
use_api_for_commits: true
44+
additional_permissions: |
45+
actions: read

AGENTS.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# CLAUDE.md
22

3-
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
3+
This file provides guidance to AI agents like Cursor/Claude Code/Codex/WARP when working with code in this repository.
44

55
## Overview
66

@@ -191,6 +191,8 @@ If anything is missing or cannot be verified, you must fix it before declaring s
191191

192192
---
193193
## RULES
194+
- ALWAYS edit AGENTS.md directly — CLAUDE.md, GEMINI.md, and WARP.md are symlinks and must not be edited or replaced with regular files
195+
- NEVER delete or recreate symlinks (CLAUDE.md, GEMINI.md, WARP.md) — they are committed to git as mode 120000
194196
- NEVER suggest manually adding @Serializable annotations to generated Kotlin bindings
195197
- ALWAYS run `cargo fmt` before committing to ensure consistent code formatting
196198
- ALWAYS move imports to the top of the file when applicable (no inline imports in functions)

0 commit comments

Comments
 (0)