Repository navigation
ci: skip build and test jobs on docs-only PRs - #12
Merged
Merged
Conversation
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.
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.
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
mainalways run full CI.What changed
ci.yml: a newchangesjob (Classify Changes).check,check-macos,windowsandother-architecturesnowneedit and run unless it succeeded and said "non-code only". The trigger keeps nopathsfilter: 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, paginatedpulls.listFiles.continue-on-errorplus an output expression that defaults to full CI unless the script successfully emitsfalse.The allowlist is PwrRoute's:
docs/**, any.mdexceptCHANGELOG.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.mdcounts as code. Once feat(release): ship a DMG and Velopack installers with in-app updates #8 lands,xtask/src/release.rsreads it, and so does a test of that check.packaging/macos/Info.plist.inis the only file compiled in. It isn't on the allowlist anyway.README.mdis only copied into release archives byrelease.yml, not built or tested here, so it stays non-code.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.rsfiles 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
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 isfailure, and full CI runs. A PR that edits the classifier tests its own edited copy.gh api repos/pwrdrvr/PwrDisk/branches/main/protectionreturns 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 inci.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.cancel-in-progressonly for PRs, toolchain pruning, cachesave-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 macOSBundlestep); this PR adds thechangesjob and aneeds/ifheader to each existing job.git merge-treemerges this branch with #8 cleanly, and with #11. Norelease.ymlchanges here. I kept the docs inci.ymlcomments 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'sci.ymlrow can point at the comment.Verification
node --test scripts/ci/classify-changes.test.cjs: 58 pass. Removing theCHANGELOG.mdexception fails 2, so the fixtures bite.actionlint .github/workflows/ci.yml: clean.cargo xtask lint: green.Live file lists. I ran this workflow's script locally against GitHub's file lists for open PRs:
AGENTS.md, theCLAUDE.mdsymlink anddocs/pr-screenshots.md. It classifies as non-code, so expensive jobs would skip..github/workflows/ci.yml.