Commit e16daf3
Add require-label option for on-demand reviews (#13)
## Summary
Adds ability to only run code reviews when a specific label is present
on the PR. The review can be triggered by adding the label, even without
pushing new commits.
## New Input
`require-label` (default: empty)
- Set to a label name (e.g., `needs-review`) to only run when that label
is present
- Leave empty to review all PRs (current behavior)
## Workflow Configuration
To trigger on label addition, include `labeled` in your workflow:
```yaml
on:
pull_request:
types: [opened, synchronize, reopened, labeled]
jobs:
review:
steps:
- uses: PSPDFKit-labs/claude-code-review@main
with:
claude-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
require-label: 'needs-review'
```
## Behavior
| Label present | Action |
|---------------|--------|
| Yes | Run review |
| No | Skip with message "required label 'X' not found" |
## Test plan
- [ ] Test PR without label → should skip
- [ ] Add label → should trigger review
- [ ] Test PR with label from start → should run
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>1 parent 6689c08 commit e16daf3
2 files changed
Lines changed: 21 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
66 | 71 | | |
67 | 72 | | |
68 | 73 | | |
| |||
106 | 111 | | |
107 | 112 | | |
108 | 113 | | |
| 114 | + | |
| 115 | + | |
109 | 116 | | |
110 | 117 | | |
111 | 118 | | |
| |||
116 | 123 | | |
117 | 124 | | |
118 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
119 | 136 | | |
120 | | - | |
| 137 | + | |
121 | 138 | | |
122 | 139 | | |
123 | 140 | | |
124 | 141 | | |
125 | | - | |
| 142 | + | |
126 | 143 | | |
127 | 144 | | |
128 | | - | |
| 145 | + | |
129 | 146 | | |
130 | 147 | | |
131 | 148 | | |
| |||
0 commit comments