Skip to content

Commit 2339b67

Browse files
authored
Merge pull request #30 from posit-dev/add-claude-review-workflow
ci: add Claude auto-review workflow for PRs
2 parents f9e4b7f + a4e3aca commit 2339b67

File tree

2 files changed

+70
-16
lines changed

2 files changed

+70
-16
lines changed

.claude/review-guidelines.md

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# PTD Code Review Guidelines
1+
# Team Operator Code Review Guidelines
22

33
## Core Principles
44

@@ -25,35 +25,32 @@ These changes require extra review attention:
2525

2626
## Review Checklist by Area
2727

28-
### Team Operator (`team-operator/`)
29-
30-
#### API Changes (`api/`)
28+
### API Changes (`api/`)
3129
- [ ] Kubebuilder annotations are correct
3230
- [ ] New fields have sensible defaults
3331
- [ ] Validation rules are present
3432
- [ ] Breaking changes have migration strategy
3533

36-
#### Controller Changes (`internal/controller/`)
34+
### Controller Changes (`internal/controller/`)
3735
- [ ] Reconciliation is idempotent
3836
- [ ] Error handling reports status correctly
3937
- [ ] Config flows from Site -> Product correctly
4038
- [ ] Both unit and integration tests exist
4139

42-
### PTD CLI (`cmd/`)
43-
- [ ] Commands support `--verbose` flag
44-
- [ ] Cloud operations use Target interface
45-
- [ ] Auto-completion works for new arguments
46-
- [ ] Error messages are actionable
40+
### Helm Chart (`dist/chart/`)
41+
- [ ] Values have sensible defaults
42+
- [ ] Templates render correctly
43+
- [ ] RBAC permissions are minimal
44+
- [ ] CRDs are up to date
4745

48-
### Python/Pulumi (`python-pulumi/`)
49-
- [ ] Configuration uses dataclasses
50-
- [ ] Pulumi resources have proper typing
51-
- [ ] Cloud provider abstraction is maintained
52-
- [ ] No hardcoded credentials or regions
46+
### Flightdeck (`flightdeck/`)
47+
- [ ] Go templates render correctly
48+
- [ ] Static assets are properly served
49+
- [ ] Configuration options are documented
5350

5451
## What NOT to Comment On
5552

56-
- Style issues handled by formatters (run `just format`)
53+
- Style issues handled by formatters (run `make fmt`)
5754
- Personal preferences without clear benefit
5855
- Theoretical concerns without concrete impact
5956

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Claude Auto Review
2+
3+
on:
4+
pull_request:
5+
types: [opened]
6+
7+
env:
8+
PTD_AWS_ACCOUNT: ${{ secrets.PTD_AWS_ACCOUNT }}
9+
10+
jobs:
11+
auto-review:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
pull-requests: read
16+
id-token: write
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 1
22+
23+
- uses: aws-actions/configure-aws-credentials@v4
24+
with:
25+
role-to-assume: arn:aws:iam::${{ env.PTD_AWS_ACCOUNT }}:role/claude-code
26+
role-session-name: gha-claude-code-action
27+
aws-region: us-east-2
28+
29+
- name: Automatic PR Review
30+
uses: anthropics/claude-code-action@beta
31+
if: github.event.pull_request.user.login != 'posit-team-dedicated[bot]'
32+
with:
33+
allowed_tools: "mcp__github__create_pull_request,mcp__github__create_issue,mcp__github__search_issues,mcp__github__update_issue,mcp__github__create_pending_pull_request_review,mcp__github__add_pull_request_review_comment_to_pending_review,mcp__github__submit_pending_pull_request_review,mcp__github__get_pull_request_diff"
34+
use_bedrock: true
35+
model: "us.anthropic.claude-opus-4-5-20251101-v1:0"
36+
fallback_model: "us.anthropic.claude-3-7-sonnet-20250219-v1:0"
37+
timeout_minutes: "60"
38+
direct_prompt: |
39+
Please review this PR following the guidelines in `.claude/review-guidelines.md`. Use the GitHub review system:
40+
41+
1. **Start a review**: Use `mcp__github__create_pending_pull_request_review` to begin a pending review
42+
2. **Get diff information**: Use `mcp__github__get_pull_request_diff` to understand the code changes and line numbers
43+
3. **Add inline comments**: Use `mcp__github__add_pull_request_review_comment_to_pending_review` for each specific piece of feedback on particular lines
44+
4. **Submit the review**: Use `mcp__github__submit_pending_pull_request_review` with event type "COMMENT" (not "REQUEST_CHANGES") to publish all comments as a non-blocking review
45+
46+
Review priorities from guidelines:
47+
- **Simplicity**: Code should be explicit, not clever. Functions do one thing. Names reveal intent.
48+
- **Maintainability**: Follow existing patterns. New code should look like it belongs.
49+
- **Security (elevated scrutiny)**: Extra attention for file system, network, credentials, RBAC, and IAM changes.
50+
51+
Use the area-specific checklists from the guidelines for API changes, Controller changes, Helm chart, and Flightdeck.
52+
53+
Provide constructive feedback with specific suggestions for improvement.
54+
Don't be overly complimentary; focus on actionable insights and keep your comments concise.
55+
Use inline comments to highlight specific areas of concern.
56+
57+
IMPORTANT: Do NOT post any additional comments after submitting the review. The GitHub review itself is sufficient and any additional summary comments will be redundant.

0 commit comments

Comments
 (0)