Skip to content

Skip the pull request workflow for draft PRs - #9993

Merged
hua7450 merged 3 commits into
mainfrom
ci-skip-draft-prs
Oct 8, 2026
Merged

hua7450 merged 3 commits into
mainfrom
ci-skip-draft-prs

Conversation

@MaxGhenis

@MaxGhenis MaxGhenis commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The PR workflow runs 35 jobs, about 570 runner-minutes per run, on every push to every open PR, drafts included. 36 of the 123 open PRs are drafts. Many PRs also get several pushes during review rounds before they are ready.

This PR makes draft PRs skip the workflow:

  • Triggers. pull_request now lists types: [opened, synchronize, reopened, ready_for_review, converted_to_draft]. Marking a PR ready for review starts a full run.
  • Guard. The three root jobs (ReleaseLock, ReleaseLockTests, check-changelog) carry if: github.event.pull_request.draft == false. Every other job needs one of them, directly or transitively, so the whole run skips for drafts. No job uses always().
  • Cancelling. Converting a PR back to draft starts a run whose jobs all skip. It shares the existing concurrency group (cancel-in-progress: true), so it cancels any run still in progress.

Branch protection is unaffected. Draft PRs can't merge, and a ready PR gets a full run.

Invariants (tested)

policyengine_us/tests/code_health/test_pr_workflow_skips_drafts.py:

  • ready_for_review and converted_to_draft are among the triggers.
  • Every job either is a guarded root, or needs only jobs that reach guarded roots.
  • No job-level condition uses a status function that runs past a skipped need (always(), cancelled(), failure()). The !cancelled() mutation on Lint fails the test.

Both tests fail on main and pass here. The existing workflow tests also pass: .github/tests/test_release_build.py (8), test_make_test_matches_ci.py (2) and test_rest_python_groups.py (12).

Readiness caveat (review finding)

On a draft, gh pr checks exits 0 with every check skipped, and mergeable stays MERGEABLE. A readiness check that only reads those two can therefore pass on code that ran no CI. The same is true in the seconds after gh pr ready, before the new run registers.

Merge tooling should also require:

  • isDraft == false;
  • a latest Pull request run at the exact head that concluded success, not skipped.

The US + core hub's merge gate now requires both.

Live check

This PR is opened as a draft. A pull_request run uses the workflow file from the PR's merge commit, so this PR's own CI should skip every job while it is a draft. Main is currently red (#9992 fixes it), so it will be marked ready after #9992 lands, and that should start the full suite.

Impact

No model output change: only the CI workflow, a test and a changelog fragment change.

axiom: n/a

🤖 Generated with Claude Code

MaxGhenis and others added 2 commits October 7, 2026 11:28
Each PR run is 35 jobs and about 570 runner-minutes. Drafts now skip every
job (the three root jobs carry the guard, the rest need them); marking a PR
ready runs the full suite, and converting back to draft starts a skipped
run that cancels the in-progress one through the concurrency group.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ped need

Review finding: a job-level `!cancelled()` passed the test while defeating
the draft guard. The test now rejects always(), cancelled() and failure()
in job-level conditions; the !cancelled() mutation on Lint fails it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MaxGhenis
MaxGhenis marked this pull request as ready for review October 7, 2026 18:26
@hua7450
hua7450 merged commit 9371e27 into main Oct 8, 2026
35 of 48 checks passed
@hua7450
hua7450 deleted the ci-skip-draft-prs branch October 8, 2026 00:13
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