Allow comment-driven reviews to run on draft PRs#38
Conversation
This updates the action trigger detection so PR comments with can run reviews directly, without needing a relay mention comment. It also adds support for the pull request event so teams can run a review immediately when a draft is marked ready. The action now adds an reaction when a slash-command review starts and a reaction when review processing completes. Reaction failures are non-fatal so review execution is never blocked by reaction permissions.
Update issue comment trigger detection to run when the comment starts with (ignoring leading whitespace and case), instead of requiring . This matches the simpler command style used in PR conversations.
Rename the action input from to and propagate the environment variable name through enablement logic. This keeps naming aligned with the plain command behavior. Update the completion reaction on command comments from to so completion feedback is distinct from review approval semantics.
The upstream workflow change was rebased onto the fork, but this fork still exposes a dedicated `trigger-on-ready-for-review` input. Keeping `ready_for_review` mapped to its own trigger type preserves that configuration knob while retaining the rebased history on top of `PSPDFKit-labs/main`.
Bot mentions and the review comment command are explicit, per-PR requests from a human, not automatic noise - exempt them from skip-draft-prs so reviewers don't have to flip a PR to ready and back just to get a review while still in draft.
…riggers Covers the trigger types added in prior commits (ready_for_review, slash_command) and the new draft-skip exemption for comment-driven triggers, following the existing test patterns in this file.
| esac | ||
| elif [ "$EVENT_NAME" == "issue_comment" ]; then | ||
| # Check if comment uses review command trigger | ||
| if echo "$COMMENT_BODY" | grep -qiE '^[[:space:]]*review([[:space:]]|$)'; then |
There was a problem hiding this comment.
🤖 Code Review Finding: review command regex matches casual comments, not just the command
Severity: LOW
Category: correctness
Impact: Unintended full reviews are triggered by ordinary PR conversation that happens to start with the word 'review', causing surprising extra runs and API cost. (Recursion from the bot's own comments is largely prevented by GitHub not re-triggering workflows for events created with the default GITHUB_TOKEN.)
Recommendation: Tighten the pattern to the documented command surface, e.g. only match review optionally followed by please and nothing else (^[[:space:]]*review([[:space:]]+please)?[[:space:]]*$), or require it to be the sole content of the line.
There was a problem hiding this comment.
Agree. tightening to review or review please
The prior pattern matched any comment starting with "review", so ordinary conversation like "review the design doc" would trigger a full run. Require the comment to be exactly "review" or "review please" instead. Addresses #38 (comment)
The inline "Detect trigger type" step (including the review-command and mention regexes) had no test coverage, unlike determine-claudecode-enablement.sh. Pull it into its own script, following the same pattern, and add a test suite covering every trigger type plus the regex edge cases from the review-command fix.
Reviewers currently have to flip a PR out of draft to get a review, then back into draft to keep working -
skip-draft-prsapplies unconditionally to every trigger, including an explicit@botmention or thereviewcomment command.This builds on Daniel Martin's unmerged fork commits (
danielmartin/nutrient-code-review) which add the plainreviewcomment command and splitready_for_reviewinto its own trigger, then adds the missing piece: the draft-PR skip now exemptsmentionandslash_commandtriggers, since those are an explicit per-PR request from a human rather than automatic noise. Automatic triggers (open,commit,ready_for_review) are unaffected and still fully respectskip-draft-prs.One commit from Daniel's fork ("Backport parser and ready-state fixes") was dropped - it re-applied an older, less strict version of review-payload parsing that's already superseded by what's on
main(PR #33), so it only produced merge conflicts with no behavioral gain.Consumer: PSPDFKit/PSPDFKit#55849 pins to this branch and is blocked on this merging.