ci: short-circuit heavy jobs for docs-only PRs (no branch-protection deadlock)#287
Merged
Conversation
…k semantics) Adds a `detect-changes` job that classifies PR changes via shell-based git diff against `github.base_ref`. Downstream code-quality / test / audit jobs gate every heavy step on `needs.detect-changes.outputs.code == 'true'` but still RUN as jobs — so branch protection's required-check list keeps seeing SUCCESS on docs-only PRs (e.g. #286 roadmap refresh) instead of burning ~10 min × 3 OS on cargo nextest + ~2 min on audit/deny. Why not paths-ignore? paths-ignore skips the whole workflow → required checks never report → docs-only PRs stuck `BLOCKED` (the #236 / #278 deadlock). Why not job-level `if: false` for docs? Same problem: SKIPPED ≠ SUCCESS for branch protection's required list. Why this design (step-level `if:`)? Job-level execution stays unconditional (SUCCESS reports), but the heavy steps short-circuit when `code != true`. Each job's first step prints a visible "✓ Docs-only PR — skipping ..." log line so it's obvious in the Actions UI what happened. Code-relevant path classification (positive list — anything else is treated as docs/config/license-only): crates/ Cargo.toml Cargo.lock .github/ scripts/ rust-toolchain* deny.toml clippy.toml rustfmt.toml `actionlint` keeps running unconditionally — it lints the workflow YAML itself (always present), and the ~30s cost is negligible. Push-to-main events always default to `code=true` regardless of detected paths (merge commits must get full validation).
This was referenced May 21, 2026
3 tasks
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.
Summary
Docs-only PRs (e.g. #286 roadmap refresh) currently burn ~10 min × 3 OS on `cargo nextest` + ~2 min on audit/deny even though no code changed. This PR fixes that without re-introducing the `paths-ignore` deadlock that left docs-only PRs `BLOCKED` forever (#236 / #278).
Design: step-level `if:` short-circuit instead of job-level `if: false`.
Code-relevant path list (positive — anything outside is docs/license/config-only):
```
crates/ Cargo.toml Cargo.lock .github/ scripts/ rust-toolchain*
deny.toml clippy.toml rustfmt.toml
```
No third-party action — shell regex is transparent + auditable.
Test plan