Skip to content

ci: skip AI review on draft PRs - #305

Merged
MegaRedHand merged 2 commits into
mainfrom
ci-skip-ai-review-on-drafts
Apr 20, 2026
Merged

MegaRedHand merged 2 commits into
mainfrom
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

greptile-apps Bot commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

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

@MegaRedHand
MegaRedHand merged commit 43f7631 into main Apr 20, 2026
2 of 3 checks passed
@MegaRedHand
MegaRedHand deleted the ci-skip-ai-review-on-drafts branch April 20, 2026 20:43
dicethedev pushed a commit to dicethedev/ethlambda that referenced this pull request Nov 4, 2026
…ctions (lambdaclass#763)

## 🗒️ Description / Motivation

`lambdaclass/actions` `v1` has moved on since our pin (`2127455`, Sep
1). It now ships three more reviewers (DeepSeek, Gemini, Grok), a
`/review` command that triggers every reviewer a repo calls, and a
Claude reviewer that is a single Messages API call instead of a Claude
Code agent run. This PR brings us up to date and adds the new reviewers.

## What Changed

`.github/workflows/ai-review.yml` only:

| Change | Detail |
|---|---|
| Pin bump | Kimi, Codex, Claude: `2127455` → `ad22254` (what `v1`
points at today), still SHA-pinned as in lambdaclass#713 |
| New reviewers | `ai-review-deepseek.yml`, `ai-review-gemini.yml`,
`ai-review-grok.yml` |
| Comment gate | Each job starts on a comment only when it begins with
its own command (`/kimi`, `/codex`, `/claude`, `/deepseek`, `/gemini`,
`/grok`) or `/review`. Before, every PR comment spawned one run per
reviewer that then skipped inside the called workflow |
| `permissions:` | `contents: read` + `pull-requests: write`, which is
all the called workflows declare; the repo default grants write to
everything |

## Correctness / Behavior Guarantees

How a review triggers:

```
pull_request: opened / ready_for_review
  └─ not a draft                      (this workflow)
       └─ head repo == this repo      (called workflow)
            └─ all 6 reviewers run

issue_comment: created
  └─ starts with /review or /<name>   (this workflow)
       └─ on a PR, author is OWNER / MEMBER / COLLABORATOR   (called workflow)
            └─ /review → all 6, /<name> → that one
```

Behavior changes reviewers should know about:

- **Missing secrets.** DeepSeek, Gemini and Grok need
`DEEPSEEK_API_KEY`, `GEMINI_API_KEY` and `XAI_API_KEY`, which this repo
does not have yet. Until they are added, each of those reviewers posts a
"secret is not set" comment and fails its check on every PR.
- **A review that does not happen now fails its check** (upstream
change): an empty response or provider outage is red rather than green
with a comment.
- **Claude reviewer** is now one API call over the diff (no checkout, no
tools), defaulting to `claude-opus-5-5` at `effort: high`. We passed
none of the removed inputs (`max_turns`, `allowed_tools`), so no `with:`
changes are needed.
- Default models moved upstream: Kimi `kimi-k3.1-pro`, Codex
`gpt-6.1-sol`.

## Tests Added / Run

- `actionlint -ignore SC2086 -ignore 'specifying action "\$/'
.github/workflows/ai-review.yml` (same flags as `pr_lint_gha.yaml`):
clean
- `gh actions-lock --verify` (same as `verify-lockfile.yml`): all 13
workflows valid; reusable workflows are not tracked in `actions.lock`,
so it needs no update

## Related Issues / PRs

- Related to lambdaclass#713 (action pinning), lambdaclass#305 (skip drafts), lambdaclass#69 (adopt
`lambdaclass/actions`)

## ✅ Verification Checklist

- [x] Ran `make fmt`: n/a, no Rust changes
- [x] Ran `make lint`: n/a, no Rust changes
- [x] Ran `make test`: n/a, no Rust changes
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.

2 participants