ci: skip pull-request CI while a PR is a draft - #36
Open
seraph-pixelperfect wants to merge 1 commit into
Open
Conversation
- subscribe pull_request to ready_for_review (plus opened/synchronize/ reopened) so marking a PR ready triggers CI without a new commit - guard build-and-test with if: github.event.pull_request.draft == false; packed-tarball is transitively skipped via its plain needs: dependency - add .github/PULL_REQUEST_TEMPLATE.md documenting the draft-first contribution sequence - add test/ci-workflow.test.ts regression coverage for the trigger types, draft guard, untouched push-on-main trigger, and the packed-tarball transitive-skip invariant Closes #4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #4
What changes
.github/workflows/ci.ymlon: push: branches: [main] pull_request: branches: [main] + types: [opened, synchronize, reopened, ready_for_review] jobs: build-and-test: + if: github.event.pull_request.draft == false runs-on: ubuntu-latest.github/PULL_REQUEST_TEMPLATE.md(new) — documents the draft-first contribution sequence: open as draft → iterate silently → mark "Ready for review" to start CI → subsequent pushes run CI as usual.test/ci-workflow.test.ts(new) — regression coverage: plain string/regex assertions on the workflow YAML (no YAML parser dependency added).Workflow semantics
opened, draft=true)build-and-testevaluatesdraft == false→ false → job skipped; no runners consumedsynchronize, draft=true)ready_for_review, draft=false)ready_for_reviewmust be intypes:: the default activity types don't include it, so without the subscription the ready transition would fire no workflow at allmain== falsedeliberately: onpusheventsgithub.event.pull_requestis null, and GitHub's expression caster maps null→0 and false→0 for==, so the guard evaluates true on pushes. A stricter form (e.g.!= null &&checks or!== true) would silently skip main-push CIWhy
packed-tarballis not separately guardedpacked-tarballhasneeds: build-and-testand noif:override. Under GitHub Actions' defaultif: success()gate, a job whoseneedsdependency was skipped is itself skipped (skipped is treated as non-success). So the draft guard transitively skipspacked-tarball— adding a duplicate guard would be redundant. The test pins this invariant: it assertsneeds: build-and-testis present and that noif: always()/failure()/cancelled()escape hatch exists that would defeat the transitive skip.Edge case the issue didn't spell out (flagged rather than silently chosen)
The issue says "do not run pull-request CI jobs while draft is true" but doesn't address
ready_for_reviewneeding explicit subscription — without adding it totypes:, the default type list (opened,synchronize,reopened) would leave a PR marked ready with stale or absent CI until the next push. This PR subscribes to all four types explicitly. Also, as shown by the issue's own evidence (draft PR #8 ranbuild-and-teston open), the priorpull_request:trigger with notypes:filter used the defaults, which fire on drafts.Local verification (real output, from the worktree at commit ace8d06)
Baseline on main was 41 tests in 6 files; this adds 4 tests in 1 new file (
test/ci-workflow.test.ts) → 45 tests, 7 files, all passing. Tests are pure file reads — no network, no Linear API.Formatting:
format:checkis red on main already (18 pre-existing files flagged by prettier 3.9.6; CI does not run format:check). Verified by diffing the flagged-file list before/after this change: identical 18 files, no new flags. The new/changed files passprettier --checkindividually.CI quota-block caveat (known in this org)
Some Actions jobs in this org get rejected pre-execution with a billing/spending-limit message, and
gh pr checksreports that as a failure. If a check here is red, inspectgh run view <run-id>for the billing annotation, orgh api repos/apexcloudwise/linear-axi/actions/runs/<id>/jobs— an emptystepsarray with ~3-4s duration means quota-blocked, not broken. If that happens, this PR relies on the local output above as evidence; the job will not be retried. This PR is opened ready (not draft) precisely so CI runs — ironic given the topic, but required for validation.Identity note
This PR was opened by an automated agent dispatch authenticated as GitHub user
seraph-pixelperfect, for human review. It is not self-approved; merge is a human decision.