The claude-review action: Claude reviews pull requests and answers @claude comments.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
a4a978bbcb
3 files changed
+263
No files matched your search
@@ -0,0 +1,62 @@
|
||||
# claude-review
|
||||
|
||||
A Gitea Actions action that has Claude review pull requests on git.teal.net.
|
||||
|
||||
- When a pull request is opened, reopened, or marked ready (not while it's a draft), Claude
|
||||
reviews it and posts the review on the pull request.
|
||||
- A comment on a pull request that mentions **@claude** gets an answer. **@claude review**
|
||||
asks for a fresh review, for example after more pushes.
|
||||
- Claude runs [Claude Code](https://code.claude.com) with read-only tools: it reads the code
|
||||
and git history, and can't change files, push, or reach the web. A `CLAUDE.md` in the
|
||||
repository is read automatically, so put the project's review rules there.
|
||||
|
||||
## Turning it on for a repository
|
||||
|
||||
1. The organization (or the repository) needs an **`ANTHROPIC_API_KEY`** secret:
|
||||
*Settings → Actions → Secrets*. Without it the action posts a note saying so.
|
||||
2. The repository needs Actions enabled (*Settings → Repository → Actions*, on by default)
|
||||
and this workflow at `.gitea/workflows/claude-review.yml`. Repositories created from
|
||||
**tealnet/repo-template** already have it.
|
||||
|
||||
```yaml
|
||||
name: Claude review
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, reopened, ready_for_review]
|
||||
issue_comment:
|
||||
types: [created]
|
||||
jobs:
|
||||
claude:
|
||||
if: >-
|
||||
(github.event_name == 'pull_request' && !github.event.pull_request.draft) ||
|
||||
(github.event_name == 'issue_comment' && github.event.issue.pull_request && contains(github.event.comment.body, '@claude'))
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
permissions:
|
||||
contents: read
|
||||
issues: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: https://git.teal.net/tealnet/claude-review@v1
|
||||
with:
|
||||
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
|
||||
model: ${{ vars.CLAUDE_MODEL }}
|
||||
```
|
||||
|
||||
## Settings
|
||||
|
||||
| Where | Name | Default |
|
||||
|---|---|---|
|
||||
| Variable (org or repo) | `CLAUDE_MODEL` | `claude-opus-5-5` |
|
||||
| Action input | `claude_code_version` | pinned in `action.yml` |
|
||||
|
||||
The prompts are in `review.sh`. Changes to `main` take effect for every repository once the
|
||||
`v1` tag is moved to them (`git tag -f v1 && git push -f origin v1`).
|
||||
|
||||
## Where it runs
|
||||
|
||||
Jobs run on the runner `git-teal-docker` on git.teal.net itself, in a Docker container
|
||||
(`ubuntu-latest` → `docker.gitea.com/runner-images:ubuntu-latest`), two at a time.
|
||||
Reference in new issue
Block a user