Repository navigation
feat(ci): Add Claude Code workflow - #1185
AkhileshNegi wants to merge 2 commits into
Conversation
Two jobs in one workflow: - `claude` — responds to @claude mentions in issues, PR comments and reviews. - `review` — auto-reviews a PR when the `ready-for-review` label is added, reusing the repo's own checklist in .claude/commands/pr-review.md so the bot review and the local /pr-review pass apply the same conventions. Requires an ANTHROPIC_API_KEY repository secret and the Claude GitHub App installed on the org. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one): 1
Please check the settings in the CodeRabbit UI or the
|
OpenAPI changes ⚪ No API surface changesNote This PR does not modify the API contract.
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
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?
| 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. |
There was a problem hiding this comment.
a few points:
- 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.
- 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.
Issue
N/A — infra setup.
Summary
Adds
.github/workflows/claude.ymlwith two jobs. Nothing else in CI changes.sequenceDiagram participant Dev participant GitHub participant Action as claude-code-action participant Repo as .claude/commands/pr-review.md Dev->>GitHub: add label ready-for-review GitHub->>Action: pull_request[labeled] Action->>Repo: read "What to check" onward Action->>GitHub: gh pr diff / gh pr view Action-->>GitHub: inline comments + one summary commentThe
reviewjob carries no review criteria of its own. It reads.claude/commands/pr-review.mdfrom the checkout, so the bot and a locally-run/pr-reviewapply the same checklist and output format. It skips that file's "Gather the diff" section (assumes full history) and usesgh pr diff/gh pr viewinstead — checkout isfetch-depth: 1.Tools are allow-listed to
create_inline_comment,gh pr comment,gh pr diff,gh pr view. Review-only — no file writes.Before this can run
ProjectTech4DevAIorg (needs an org owner).ANTHROPIC_API_KEYas a repository or org Actions secret.Until both are done, both jobs are inert.
Evidence
claude.yml;@claudementions andready-for-reviewlabel do nothing.After: YAML parses, both jobs present:
validatecheck passes on this PR. Live end-to-end run blocked on the two setup items above.Merge Danger
Door: two-way
Revert = delete one file. No app code, no migration, no secrets committed.
Blast Radius: CI-only
concurrency+cancel-in-progressonreviewstops label remove/re-add from stacking runs.ready-for-reviewis the same label CodeRabbit uses (.coderabbit.yaml), so one label fires both reviewers. If noisy, change the label here — one-line edit.pull_requestdoesn't expose secrets to forks, soreviewsilently no-ops there. Deliberate —pull_request_targetwould hand the key to untrusted code.claudejob hascontents: write— it can push fix commits when asked via@claude. Scoped to repo collaborators by the App's own auth.actions/checkout@v7matchescontinuous-integration.yml.Stophook (wiki-update.sh) runs on these jobs too: exits 0 onreview; onclaudeit nudges for adocs/wiki/update when the change is structural (intended).Checklist
fastapi run --reload app/main.py— N/A, CI-only change