Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions .github/workflows/claude.yml

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we implement an agent bot for this so that whenever it needs to comment on a PR or an issue, it does so through the respective PR/issue itself?

Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Claude Code

on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
pull_request_review:
types: [submitted]
issues:
types: [opened, assigned]
pull_request:
types: [labeled]

jobs:
claude:
if: |
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
issues: write
id-token: write
actions: read # lets Claude read CI results on PRs
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 1

- uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}

review:
if: github.event_name == 'pull_request' && github.event.label.name == 'ready-for-review'
runs-on: ubuntu-latest
concurrency:
group: claude-review-${{ github.event.pull_request.number }}
cancel-in-progress: true
permissions:
contents: read
pull-requests: write
id-token: write
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 1

- uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
track_progress: true
prompt: |
REPO: ${{ github.repository }}
PR NUMBER: ${{ github.event.pull_request.number }}

Review this PR against the repository's own review checklist.

1. Read `.claude/commands/pr-review.md` and follow it from the "What to check"
section onward, together with "How to write the comments" and "Output format".
2. Skip its "Gather the diff" section — that one assumes a local clone. Use
`gh pr diff` for the diff and `gh pr view` for the description and commits.
3. Read the full files at non-trivial change sites before judging them, and
check `docs/wiki/INDEX.md` for the touched module before claiming that a
helper, service, or entity does not already exist.

Post specific findings as inline comments citing path:line, and the summary as
a single top-level comment. Review only — do not modify files.
Comment on lines +59 to +72

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few points:

  1. we should also add type-safety rules so the agent checks for them as well. or maybe in the code-review command as well. otherwise, over time, any tends to start getting used everywhere.
  2. we should add some rules around code quality as well, such as keeping functions below a certain number of lines, following the DRY principle, and checking for unnecessary code duplication.

claude_args: |
--allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)"
Loading