Commit 34e3750
ci: Claude Code Review workflow Update 2 (assistant-ui#2660)
Implement dual-path architecture to support both internal and cross-repository
pull request reviews while navigating GitHub's OIDC security boundaries.
## Architecture Changes
### Dual-trigger system
- Add `pull_request` trigger alongside existing `pull_request_target`
- Internal PRs use pull_request + OIDC authentication (claude[bot] identity)
- Fork PRs use pull_request_target + github_token (github-actions[bot] identity)
- Job-level XOR logic ensures only one path executes per PR
**Why:** GitHub prevents OIDC with pull_request_target to protect secrets from
untrusted forks. claude-code-action requires OIDC for claude[bot] identity,
forcing us to use github_token for forks (creates github-actions[bot] instead).
### Conditional action steps
Replace single action step with two conditional steps:
**Internal Review:**
- Trigger: pull_request event + same repository
- Auth: claude_code_oauth_token (OIDC)
- Identity: claude[bot]
- Features: Full sticky comment support
**Fork Review:**
- Trigger: pull_request_target event + different repository
- Auth: github_token (GITHUB_TOKEN secret)
- Identity: github-actions[bot]
- Features: allowed_non_write_users: '*' for fork contributors
## Review Quality Improvements
### Comprehensive review prompt
Move from inline checklist to sophisticated multi-stage review process:
**Context gathering phase:**
- Check CI status via mcp__github_ci__get_ci_status
- Fetch previous reviews via gh pr view --comments
- Track previously identified issues across commits
- Analyze workflow failures via mcp__github_ci__get_workflow_run_details
**Review approach:**
- First review: Comprehensive analysis of all changes
- Subsequent reviews: Incremental feedback tracking issue status (Fixed/Unresolved/New)
- Incorporate CI/test failure context into feedback
- Prohibit meta-commentary about review process itself
**Review criteria:**
- Code quality and best practices
- Potential bugs and security implications
- Performance considerations and test coverage
- assistant-ui requirements (changesets, documentation)
### Inline comment quality controls
- Restrict to critical code issues or relevant suggestions
- Check for existing comments to prevent duplicates
- Prohibit use for good practices or positive observations
- Require actionable, precise feedback
### Tool restrictions
- Remove gh pr comment permissions (prevents spam)
- Require use of mcp__github_comment__update_claude_comment
- Allow read-only gh commands (pr view, diff, list)
- Enable inline comments via mcp__github_inline_comment__create_inline_comment
## Fork PR Comment Management
Add GraphQL minimization script for fork PRs:
- Collapses previous github-actions[bot] comments as OUTDATED
- Runs only on cross-repository PRs (pull_request_target)
- Supports pagination for handling many comments
- No external dependencies (pure github-script@v8)
**Why:** Fork PRs can't use sticky comments due to bot identity change
(github-actions[bot] instead of claude[bot]). Minimizing old comments
keeps discussion clean until sticky comment support is added.
**Note:** Temporary workaround until anthropics/claude-code-action#411 merges.
PR assistant-ui#411 adds sticky_comment_app_bot_id/name config for github-actions[bot].
## CI Integration
Enable progress tracking and CI tool access:
- Set TRACK_PROGRESS: 'true' to load mcp__github_ci__* tools
- Add additional_permissions: actions: read
- Enable Claude to access test results and workflow run details
- Support context-aware reviews based on CI status
## Configuration Improvements
### DRY environment variables
Extract shared configuration to env block:
- REVIEW_PROMPT: Comprehensive review instructions
- CLAUDE_ARGS: Tool allowlist and restrictions
- TRACK_PROGRESS: Enable CI MCP tools
- USE_STICKY_COMMENT: Enable sticky comment mode
- ADDITIONAL_PERMISSIONS: Grant actions: read access
### Checkout optimization
- Change from head.repo.full_name + head.ref to refs/pull/{number}/head
- Universal reference works for both internal and cross-repository PRs
- Ensures correct code is reviewed regardless of fork status
### Resource controls
- Add timeout-minutes: 15 to prevent runaway costs
- Upgrade to checkout@v5 and github-script@v8
## claude.yml Refinements
Reduce workflow noise and modernize dependencies:
- Remove pull_request_review trigger (eliminates duplicate check runs)
- Simplify bot filtering (delegate to claude-code-action)
- Remove manual github.event.sender.type == 'User' checks
- Upgrade actions/github-script@v7 → @v8
- Upgrade actions/checkout@v4 → @v51 parent 0ee6562 commit 34e3750
2 files changed
+181
-47
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
12 | 84 | | |
13 | 85 | | |
14 | 86 | | |
15 | | - | |
16 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
17 | 95 | | |
| 96 | + | |
18 | 97 | | |
19 | 98 | | |
20 | 99 | | |
| |||
24 | 103 | | |
25 | 104 | | |
26 | 105 | | |
27 | | - | |
| 106 | + | |
28 | 107 | | |
29 | | - | |
30 | | - | |
| 108 | + | |
31 | 109 | | |
32 | 110 | | |
33 | | - | |
34 | | - | |
35 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
36 | 120 | | |
37 | | - | |
38 | | - | |
39 | | - | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
40 | 129 | | |
41 | | - | |
42 | | - | |
43 | | - | |
| 130 | + | |
44 | 131 | | |
45 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
46 | 152 | | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
| 153 | + | |
| 154 | + | |
52 | 155 | | |
53 | | - | |
54 | | - | |
55 | | - | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
56 | 160 | | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
| 161 | + | |
63 | 162 | | |
64 | | - | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
65 | 174 | | |
66 | | - | |
67 | | - | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
68 | 178 | | |
69 | | - | |
70 | | - | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
71 | 183 | | |
72 | | - | |
73 | | - | |
74 | | - | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
75 | 197 | | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
12 | 10 | | |
13 | 11 | | |
14 | 12 | | |
15 | | - | |
| 13 | + | |
16 | 14 | | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
21 | 18 | | |
22 | 19 | | |
23 | 20 | | |
| |||
26 | 23 | | |
27 | 24 | | |
28 | 25 | | |
29 | | - | |
| 26 | + | |
30 | 27 | | |
31 | 28 | | |
32 | 29 | | |
| |||
57 | 54 | | |
58 | 55 | | |
59 | 56 | | |
60 | | - | |
| 57 | + | |
61 | 58 | | |
62 | 59 | | |
63 | 60 | | |
| |||
0 commit comments