Skip to content

Allow comment-driven reviews to run on draft PRs#38

Merged
amit-nayar merged 9 commits into
mainfrom
amit/review-on-draft-prs
Jul 16, 2026
Merged

Allow comment-driven reviews to run on draft PRs#38
amit-nayar merged 9 commits into
mainfrom
amit/review-on-draft-prs

Conversation

@amit-nayar

@amit-nayar amit-nayar commented Jul 16, 2026

Copy link
Copy Markdown

Reviewers currently have to flip a PR out of draft to get a review, then back into draft to keep working - skip-draft-prs applies unconditionally to every trigger, including an explicit @bot mention or the review comment command.

This builds on Daniel Martin's unmerged fork commits (danielmartin/nutrient-code-review) which add the plain review comment command and split ready_for_review into its own trigger, then adds the missing piece: the draft-PR skip now exempts mention and slash_command triggers, 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 respect skip-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.

danielmartin and others added 6 commits July 16, 2026 14:36
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.
@amit-nayar amit-nayar self-assigned this Jul 16, 2026
@amit-nayar
amit-nayar marked this pull request as ready for review July 16, 2026 13:21
Comment thread action.yml Outdated
esac
elif [ "$EVENT_NAME" == "issue_comment" ]; then
# Check if comment uses review command trigger
if echo "$COMMENT_BODY" | grep -qiE '^[[:space:]]*review([[:space:]]|$)'; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@amit-nayar
amit-nayar merged commit abe62f8 into main Jul 16, 2026
2 checks passed
@amit-nayar
amit-nayar deleted the amit/review-on-draft-prs branch July 16, 2026 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants