Skip to content

ci: skip CI runs on draft pull requests#180

Merged
behinddwalls merged 2 commits into
mainfrom
no-ci-on-draft
Jun 2, 2026
Merged

ci: skip CI runs on draft pull requests#180
behinddwalls merged 2 commits into
mainfrom
no-ci-on-draft

Conversation

@behinddwalls
Copy link
Copy Markdown
Collaborator

@behinddwalls behinddwalls commented Jun 2, 2026

Why?

Draft PRs are work-in-progress and don't need the full CI suite running
on every push. Running lint, build, unit, integration, and e2e jobs on
drafts wastes runner capacity and adds noise while the author is still
iterating.

What?

  • Guard every job (and the required-checks gate) with
    github.event_name != 'pull_request' || github.event.pull_request.draft == false.
    The event_name half keeps push (main) and merge_group (merge
    queue) running, since pull_request.draft is null for those events.
  • Preserve the required-checks gate's if: always() by combining it
    with the draft guard, so draft PRs don't fail on the gate's
    treat-skipped-as-failure logic.
  • Add ready_for_review to pull_request.types so CI triggers when a
    draft is marked ready — the existing opened/reopened/synchronize types
    don't fire on that transition.

Test Plan

✅ YAML validated with yaml.safe_load. Behavior to confirm post-merge:
draft PRs run no jobs; marking a PR ready, pushes to main, and merge
queue all run the full suite.

### Why?

Draft PRs are work-in-progress and don't need the full CI suite running
on every push. Running lint, build, unit, integration, and e2e jobs on
drafts wastes runner capacity and adds noise while the author is still
iterating.

### What?

- Guard every job (and the `required-checks` gate) with
  `github.event_name != 'pull_request' || github.event.pull_request.draft == false`.
  The `event_name` half keeps `push` (main) and `merge_group` (merge
  queue) running, since `pull_request.draft` is null for those events.
- Preserve the `required-checks` gate's `if: always()` by combining it
  with the draft guard, so draft PRs don't fail on the gate's
  treat-skipped-as-failure logic.
- Add `ready_for_review` to `pull_request.types` so CI triggers when a
  draft is marked ready — the existing opened/reopened/synchronize types
  don't fire on that transition.

### Test Plan

✅ YAML validated with `yaml.safe_load`. Behavior to confirm post-merge:
draft PRs run no jobs; marking a PR ready, pushes to main, and merge
queue all run the full suite.
@behinddwalls behinddwalls marked this pull request as ready for review June 2, 2026 18:54
@behinddwalls behinddwalls requested review from a team and sbalabanov as code owners June 2, 2026 18:54
@behinddwalls behinddwalls enabled auto-merge June 2, 2026 19:00
@behinddwalls behinddwalls disabled auto-merge June 2, 2026 19:03
@behinddwalls behinddwalls merged commit 9394890 into main Jun 2, 2026
14 checks passed
@behinddwalls behinddwalls deleted the no-ci-on-draft branch June 2, 2026 19:05
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