.github: add low-risk label trigger for Claude review with approval#1095
.github: add low-risk label trigger for Claude review with approval#1095hieblmi merged 1 commit intolightninglabs:masterfrom
Conversation
|
Note Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported. |
starius
left a comment
There was a problem hiding this comment.
LGTM!
Some proposals added.
| - Security concerns | ||
| - Test coverage | ||
|
|
||
| Use the repository's CLAUDE.md for guidance on style and conventions. |
| pull_request: | ||
| types: [labeled, synchronize] |
There was a problem hiding this comment.
Does it have access to secrets.CLAUDE_CODE_OAUTH_TOKEN?
Codex thinks that we need to add this so it had access to it in PRs from forks:
pull_request:
types: [labeled, synchronize]
+ pull_request_target:
+ types: [labeled, synchronize]There was a problem hiding this comment.
Yes we have access, the @claude wouldn't work otherwise
|
|
||
| claude-approve: | ||
| if: | | ||
| github.event_name == 'pull_request' && |
There was a problem hiding this comment.
Then we need to replace pull_request with pull_request_target here
| If you find ANY significant issues, do NOT approve. Instead, leave a | ||
| comment explaining the problems using: | ||
| gh pr comment ${{ github.event.pull_request.number }} --body "Your review findings" |
There was a problem hiding this comment.
The bot can request changes to undo its previous approval:
If NOT approving:
gh pr review ${{ github.event.pull_request.number }} --request-changes --body "Claude review: not eligible for low-risk auto-approval. Include intrinsic PR risk and findings w
ith severities."
| uses: anthropics/claude-code-action@v1 | ||
| with: | ||
| claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} | ||
| prompt: | |
There was a problem hiding this comment.
I propose to separate intrinsic severity of the PR (e.g. whether it touches any code working with funds) and severity of potential problems found in the PR (where or not PR itself is valid). If any of these is higher than low, do not use auto-approve flow.
Here is the whole prompt:
REPO: ${{ github.repository }}
PR NUMBER: ${{ github.event.pull_request.number }}
Review this pull request thoroughly, checking for:
- Code quality and best practices
- Potential bugs or issues
- Performance considerations
- Security concerns
- Test coverage
Use the repository's AGENTS.md for guidance on style and conventions.
Classify the PR's intrinsic risk severity using one of:
- critical: must block merge
- high: large blast radius or very sensitive code paths
- medium: meaningful production or maintainability risk
- low: constrained blast radius and straightforward rollback
Intrinsic risk is about the impact and sensitivity of changed code,
even when no concrete bug is found.
Any changes touching fund movement, signing/sweeping, swap state
transitions, security/authz/authn logic, secrets handling, or DB
schema/migrations are at least medium risk.
Also classify each finding using one of:
- critical
- high
- medium
- low
- nit
Decision rule:
- Approve ONLY if intrinsic PR risk is low AND highest finding
severity is low or nit.
- If intrinsic PR risk is medium/high/critical, DO NOT approve and
submit a changes-requested review.
- If any finding is medium/high/critical, DO NOT approve and submit
a changes-requested review.
- If uncertain, treat as medium risk.
If approving:
gh pr review ${{ github.event.pull_request.number }} --approve --body "Claude review: intrinsic PR risk low and findings low/nit; safe for low-risk path."
If NOT approving:
gh pr review ${{ github.event.pull_request.number }} --request-changes --body "Claude review: not eligible for low-risk auto-approval. Include intrinsic PR risk and findings with severities."
There was a problem hiding this comment.
Thank you for the great refinement.
3cefdc1 to
9014843
Compare
- Add pull_request_target trigger for fork secret access - Use pull_request_target in claude-approve if-condition - Replace CLAUDE.md references with AGENTS.md - Replace simple approve/comment prompt with comprehensive risk-classification prompt (intrinsic PR risk + finding severity) - Use --request-changes instead of comment when not approving
9014843 to
06d978c
Compare
Summary
Its up to the PR creator to apply the low-risk label after judging the PR impact.
The first PR reviewer(besides claude) must then assess the severity category.
If they aggree claude's green check counts.
claude-approvejob triggered by thelow-risklabelgh pr review --approveonly if no significant issues are foundpull-requests: writepermission (scoped only to this job)claude-reviewjob (comment-only) remains unchangedTriggers
@claudementionclaude-reviewclaude-reviewlabelclaude-reviewlow-risklabelclaude-approveTest plan
low-risklabel to a clean PR — Claude should review and approvelow-risklabel to a PR with issues — Claude should comment without approving@claudemention andclaude-reviewlabel still work as comment-only