Fix code review workflow trigger and hardening#7
Conversation
Greptile SummaryThis PR hardens the reusable Key changes:
Issues found:
Confidence Score: 3/5Not safe to merge as-is — the literal comment line in The overall direction and structural changes are solid (pinned SHAs, tighter permissions, correct .github/workflows/code-review.yml — specifically line 83 (comment in Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A([Trigger]) --> B{Event type?}
B -- pull_request --> C{Is draft?}
B -- workflow_call --> D{pr_number set?}
C -- Yes --> Z([Skip — draft PR])
C -- No --> E{Same-repo fork?}
D -- No --> Z2([Skip — no PR context])
D -- Yes --> F{head_repo_full_name match or unset?}
E -- No --> Z3([Skip — fork])
E -- Yes --> G[review job]
F -- No --> Z4([Skip — fork])
F -- Yes --> G
G --> H[Request Copilot review
continue-on-error: true]
H --> I[Checkout @ SHA
fetch-depth: 0]
I --> J[claude-code-action @ SHA
--model opus
--max-turns 30]
J --> K([Post inline review comments])
Reviews (1): Last reviewed commit: "🐛 fix: harden reusable code review work..." | Re-trigger Greptile |
| ) || ( | ||
| github.event_name == 'workflow_call' && | ||
| inputs.pr_number && | ||
| ( | ||
| !inputs.head_repo_full_name || | ||
| inputs.head_repo_full_name == github.repository | ||
| ) | ||
| ) |
There was a problem hiding this comment.
workflow_call path has no draft-PR guard
The pull_request branch of the if condition correctly checks !github.event.pull_request.draft, but the workflow_call branch has no equivalent. A caller that triggers this workflow for a draft PR will not be blocked.
This is likely intentional (delegating the draft check to callers), but it's an implicit contract that is easy to miss and could lead to unnecessary review runs on in-progress work. Consider either documenting this assumption clearly in the workflow comment, or adding an optional is_draft input so callers can pass the flag and this workflow can enforce it uniformly.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8bd03579fd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- 🐛 move claude args note outside the literal block - 🐛 skip reusable runs for draft pull requests - 🐛 cap checkout history to enough review context
- 🐛 restore id-token for claude action auth
Summary
workflow_callinputs so the review job works for both direct PR runs and reusable callersTesting