Skip to content

ci: skip AI review on draft PRs#305

Open
MegaRedHand wants to merge 1 commit intomainfrom
ci-skip-ai-review-on-drafts
Open

ci: skip AI review on draft PRs#305
MegaRedHand wants to merge 1 commit intomainfrom
ci-skip-ai-review-on-drafts

Conversation

@MegaRedHand
Copy link
Copy Markdown
Collaborator

Summary

  • Gate the three ai-review.yml jobs on github.event.pull_request.draft == false so Kimi/Codex/Claude reviews only run once a PR is actually up for review.
  • Keep types: [opened, ready_for_review] so PRs opened directly as non-draft still trigger (only opened fires in that case; ready_for_review fires on draft → ready).
  • Issue-comment triggers (/kimi, /codex, /claude) are preserved via github.event_name == 'issue_comment' in the gate.

Test plan

  • Open a draft PR — no AI review jobs run.
  • Open a non-draft PR — all three AI review jobs run.
  • Open a draft PR, then mark ready — all three jobs run on the ready_for_review event.
  • Comment /claude (or /kimi, /codex) on any PR — the corresponding job still runs.

Gate the ai-review jobs on `draft == false` so Kimi/Codex/Claude only
run once a PR is actually open for review. PRs opened directly as
non-draft still fire the `opened` event; draft → ready transitions
fire `ready_for_review`. Issue-comment triggers (`/kimi`, `/codex`,
`/claude`) are unaffected.
@github-actions
Copy link
Copy Markdown

🤖 Kimi Code Review

This change correctly prevents AI review jobs from running on draft pull requests while preserving the ability to trigger reviews via issue comments. The short-circuit evaluation in the condition (||) safely handles the case where github.event.pull_request may be null for non-PR issue comments.

Verdict: LGTM. The logic is sound and the implementation follows GitHub Actions best practices.


Automated review by Kimi (Moonshot AI) · kimi-k2.5 · custom prompt

@github-actions
Copy link
Copy Markdown

🤖 Codex Code Review

No findings.

The change in ai-review.yml and the equivalent guards at ai-review.yml and ai-review.yml looks correct: automatic review jobs are skipped for draft PRs on pull_request events, while comment-triggered runs still remain available via issue_comment. That matches the documented intent in the workflow header and does not affect consensus logic, state transition code, or cryptographic paths.

Residual risk is minimal and operational rather than code-level: this relies on the reusable review workflows continuing to handle issue_comment events safely, including comments on non-PR issues, but that behavior pre-existed this patch and is not introduced here. No runtime verification was available beyond static inspection because the PR only changes GitHub Actions YAML.


Automated review by OpenAI Codex · gpt-5.4 · custom prompt

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 17, 2026

Greptile Summary

Adds if: github.event_name == 'issue_comment' || github.event.pull_request.draft == false to all three AI review jobs (kimi-review, codex-review, claude-review). The condition correctly handles all four trigger scenarios: draft PRs are skipped, non-draft opens run, ready_for_review runs (because draft is false by the time that event fires), and slash-command comments always run.

Confidence Score: 5/5

Safe to merge — the condition logic is correct and handles all documented trigger scenarios.

Single-file CI change with no P0/P1 findings. The if guard correctly gates on draft == false for PR events while preserving issue_comment pass-through and ready_for_review semantics.

No files require special attention.

Important Files Changed

Filename Overview
.github/workflows/ai-review.yml Adds if guards to all three AI review jobs to skip execution on draft PRs, while preserving issue_comment triggers and ready_for_review behavior.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Workflow triggered] --> B{Event type?}
    B -->|issue_comment| C[Run AI review jobs]
    B -->|pull_request| D{PR is draft?}
    D -->|Yes - opened as draft| E[Skip all AI review jobs]
    D -->|No - opened as non-draft| C
    B -->|pull_request - ready_for_review| F["draft == false at event time"]
    F --> C
    C --> G[kimi-review]
    C --> H[codex-review]
    C --> I[claude-review]
Loading

Reviews (1): Last reviewed commit: "ci: skip AI review on draft PRs" | Re-trigger Greptile

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.

1 participant