From 76de05c305c895696b72da624f7e834bc4f3bd69 Mon Sep 17 00:00:00 2001 From: PerfectPan <24316656+PerfectPan@users.noreply.github.com> Date: Tue, 3 Nov 2026 17:12:10 +0800 Subject: [PATCH] ci: skip full checks for draft pull requests --- .github/workflows/ci.yml | 1 + .github/workflows/version-packages.yml | 4 ++-- CONTRIBUTING.md | 13 +++++++++++++ docs/development/release.md | 25 ++++++++++++++----------- 4 files changed, 30 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 291d6c8a..a248af2a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,7 @@ concurrency: jobs: check: + if: github.event_name != 'pull_request' || !github.event.pull_request.draft name: check runs-on: ubuntu-latest timeout-minutes: 20 diff --git a/.github/workflows/version-packages.yml b/.github/workflows/version-packages.yml index 3c725929..6ab1aaf6 100644 --- a/.github/workflows/version-packages.yml +++ b/.github/workflows/version-packages.yml @@ -68,8 +68,8 @@ jobs: fi # Runs the version script `release:version`: `pnpm version -r` bumps the versioning.fixed group to one shared # version (the largest bump across the pending changesets), writes each package's CHANGELOG.md and deletes the - # consumed changesets, then `pnpm run check` runs the release gates on the bumped tree. A pull request opened - # with github.token starts no CI until it is marked ready for review, so the gates run here. The action runs + # consumed changesets, then `pnpm run check` runs the release gates on the bumped tree. Every update leaves + # the release PR in Draft; a maintainer marks it Ready for full PR CI. The action runs # the script before it pushes anything, so a failing gate fails the run and leaves the release PR as it was. # Otherwise the action commits through the GitHub API (signed) and opens or updates the draft PR # `changeset-release/main` -> `main`, whose body lists each package's new changelog section. That commit takes diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 110111d0..15ddb67d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -90,6 +90,19 @@ gh repo-checks protect --repo OWNER/REPO pnpm run publish:dry-run ``` +The full `CI` job named `check` runs when a non-Draft PR is opened, receives new commits (`synchronize`), is +reopened, or is marked Ready for review. It also continues to run on pushes to `main`. Keep work in Draft until +local checks are finished; ordinary and Renovate PRs opened directly as Ready get CI automatically. + +The separate lightweight `Review` workflow continues to check repository metadata, PR titles and descriptions +on Draft PRs and description edits. It does not install project dependencies or run the full test suite. Bot +authors remain exempt only from the description check. + +When a Draft PR event starts CI, `check` is skipped. GitHub reports skipped jobs as successful, so a green skipped +status is not validation evidence, even when `check` is required by branch protection. After marking the PR Ready, +confirm that `check` actually ran and passed for the current head and merge result before merging. Metadata edits +do not restart full CI; a changed base or comparison still needs a fresh PR validation when the head has not moved. + ## Changesets pnpm builds changelogs and version bumps from changesets in `.changeset/`. A PR that changes what a published diff --git a/docs/development/release.md b/docs/development/release.md index 8fc482fc..20590ebe 100644 --- a/docs/development/release.md +++ b/docs/development/release.md @@ -174,12 +174,12 @@ the run fails at it with an authentication error. Configure the publisher and re 3. A breaking release is one whose change records remove or change a public export or a documented behavior. In 0.x, such a change is recorded as `minor`. For these releases, follow the [application comparison and upgrade procedure](adoption.md#application-comparison-before-release). - Review the version and changelog diff, then select - **Ready for review**. Pull requests created with the - workflow's `github.token` do not trigger workflows, and the `ready_for_review` event starts CI (closing and - reopening the PR also works). Wait for green checks and squash-merge. To skip the extra click, pass a GitHub App - token or a fine-grained PAT to the action's `github-token` input, never through the `GITHUB_TOKEN` environment - variable, which the action rejects when it differs from the input. + Every version update leaves the release PR in Draft (`pr-draft: always`). Review the version and changelog diff, + then select **Ready for review** to start full PR CI. Closing and reopening a Draft PR does not bypass the Draft + guard. Confirm that `check` actually ran and passed for the current head and merge result before squash-merging; + a skipped check is not validation evidence. PR events created with `github.token` may create runs that require + maintainer approval; follow any GitHub approval prompt rather than assuming no run exists. Changing token type + does not remove the release PR's Draft gate, and this flow needs no new token permissions. 4. The merge push runs Publish npm on the merge commit. After waiting for any other run of the same version, it checks the state again, creates the annotated tag `vX.Y.Z` locally, and runs `release:check --verify-git`: the tag equals the version of every published package, no changesets remain and the commit is on `origin/main`. It @@ -379,9 +379,12 @@ Run it after `pnpm run check` so `dist` exists. and blocks the version number permanently; prefer deprecation. - Once any package of a version is on npm, do not move or reuse its tag. Fix forward with a new version. -## CI Trigger Options +## CI Triggers -`ci.yml` runs on ordinary `pull_request` and `push` events, which is enough for a single-maintainer repository. A -repository that wants CI to validate an exact head/base pair, or to skip CI on drafts, can replace it with a -`workflow_dispatch` workflow that takes `head_sha`/`base_sha` inputs and re-checks the PR head before and after the -run. That design costs a manual trigger per PR; adopt it only when stale or racing CI results are a real problem. +`ci.yml` runs full checks for Ready PRs on `opened`, `synchronize`, `reopened` and `ready_for_review`, and retains +the existing `push` trigger on `main`. Draft PR events skip the full `check` job; lightweight `Review` checks still +run. Release PRs keep their manual Draft-to-Ready handoff. There is no manual dispatch in this CI workflow. + +Verify an executed successful `check` for the current head and merge result, not a skipped Draft check or a result +for an older comparison. If only the base changed, update the branch or select Draft then Ready to request fresh +PR validation. See [Required Checks](../../CONTRIBUTING.md#required-checks) for the shared PR policy.