Skip to content

ci: skip build and test jobs on docs-only PRs - #12

Merged
Harold Hunt (huntharo) merged 2 commits into
mainfrom
ci/classify-changes
Oct 30, 2026
Merged

Harold Hunt (huntharo) merged 2 commits into
mainfrom
ci/classify-changes

Conversation

@huntharo

@huntharo Harold Hunt (huntharo) commented Oct 30, 2026 •

Copy link
Copy Markdown

PRs that change only docs, Markdown, agent skills or issue/PR templates now skip the four build-and-test jobs. Those jobs take tens of minutes across six runners, and they still report as skipped, so a docs PR doesn't sit waiting on checks. Pushes to main always run full CI.

What changed

  • ci.yml: a new changes job (Classify Changes). check, check-macos, windows and other-architectures now need it and run unless it succeeded and said "non-code only". The trigger keeps no paths filter: a path filter makes jobs vanish instead of skip.
  • scripts/ci/classify-changes.test.cjs: 58 fixtures that run the workflow's own inline script, plus the job conditions, without credentials or npm.

Ported from PwrRoute (which took it from PwrAgent)

Verbatim in behaviour:

  • actions/github-script, paginated pulls.listFiles.
  • Fails open to full CI on non-PR events, lookup errors, incomplete pagination (including the 3,000-file cap), bad counts, malformed or duplicate entries, and a rename without its old path.
  • continue-on-error plus an output expression that defaults to full CI unless the script successfully emits false.
  • Downstream jobs also run when the classifier job fails.
  • A step summary.

The allowlist is PwrRoute's: docs/**, any .md except CHANGELOG.md, .agents/skills/**, issue/PR templates and .github/dependabot.yml. Both paths of a rename must qualify.

What PwrDisk embeds or reads. I checked every include_str!/include_bytes! and every file a build or test reads:

  • CHANGELOG.md counts as code. Once feat(release): ship a DMG and Velopack installers with in-app updates #8 lands, xtask/src/release.rs reads it, and so does a test of that check.
  • packaging/macos/Info.plist.in is the only file compiled in. It isn't on the allowlist anyway.
  • README.md is only copied into release archives by release.yml, not built or tested here, so it stays non-code.
  • Nothing else under docs/, packaging/ or in any Markdown file is consumed.

One test is new rather than ported: it scans every include_str!/include_bytes! in tracked .rs files and fails if any of those paths would be allowlisted. It's there so that adding something like #![doc = include_str!("../README.md")] can't quietly turn into a skipped build.

Left out, and why

  • Node in cargo xtask lint. PwrRoute runs the fixtures from its lint chain. PwrDisk's gate is Rust-only and is the documented local gate on Linux, macOS and Windows. Taking Node would make it a requirement for every contributor to a Rust app, and would run the same JS test three times per PR. Instead the fixtures run in the Classify Changes job itself, after the classifier step. If they fail, that check goes red, the job result is failure, and full CI runs. A PR that edits the classifier tests its own edited copy.
  • Required-check plumbing. gh api repos/pwrdrvr/PwrDisk/branches/main/protection returns 404 and there are no rulesets, so nothing is required today. Skipped jobs satisfy required checks, the same mechanism PwrRoute relies on. One caveat for later, noted in ci.yml: a skipped matrix job reports one check under its unexpanded name, Test (${{ matrix.name }}). If protection is added, require the named jobs or an aggregate, not a matrix leg.
  • PwrRoute's other CI changes: SHA-pinned actions, cancel-in-progress only for PRs, toolchain pruning, cache save-if, the self-hosted fork guard. They aren't part of the classifier, and PwrDisk runs only hosted runners.

Merging with #8

#8 changes one comment in ci.yml (above the macOS Bundle step); this PR adds the changes job and a needs/if header to each existing job. git merge-tree merges this branch with #8 cleanly, and with #11. No release.yml changes here. I kept the docs in ci.yml comments and the test file's header rather than adding .github/workflows/README.md, because #8 creates that file and both adding it would conflict. After #8 lands, its README's ci.yml row can point at the comment.

Verification

Port PwrRoute's Classify Changes job (from PwrAgent): PRs whose every
changed path is docs, Markdown (except CHANGELOG.md), agent skills or
templates skip the four build-and-test jobs, which still report as
skipped. Pushes and any classifier failure run full CI. The classifier's
fixtures run in that job with node --test, keeping cargo xtask lint
Rust-only.
@huntharo
Harold Hunt (huntharo) merged commit 8d14a7a into main Oct 30, 2026
7 checks passed
Harold Hunt (huntharo) added a commit that referenced this pull request Oct 30, 2026
#7 added bundle-macos-26 after #12's classifier test began listing every
CI job, so main's Classify Changes fails. The job runs unless the
classifier says non-code only, as its neighbours do.
@huntharo
Harold Hunt (huntharo) deleted the ci/classify-changes branch November 9, 2026 03:30
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.

1 participant