ci: add path filters to clippy and tests workflows - #715
Conversation
Only trigger clippy and test workflows when Rust source files, Cargo manifests, Cargo.lock, or the workflow file itself changes. Avoids unnecessary CI runs on docs-only or config-only changes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR adds paths filters to the push and pull_request triggers in both clippy.yml and tests.yml CI workflows, so that these workflows only run when Rust-related files (*.rs, Cargo.toml, Cargo.lock, or the workflow file itself) are changed — avoiding unnecessary runner consumption on documentation, asset, or other non-Rust changes.
Changes:
clippy.yml: Addedpathsfilters topushandpull_requesttriggers.tests.yml: Addedpathsfilters topushandpull_requesttriggers.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
.github/workflows/clippy.yml |
Adds paths triggers for Rust-related files to avoid running the Clippy/format check on irrelevant changes |
.github/workflows/tests.yml |
Adds paths triggers for Rust-related files to avoid running the test suite on irrelevant changes |
Two categories of issues were found:
Missing path entries: Both rust-toolchain.toml (which pins the Rust toolchain version, currently 1.92) and .cargo/config.toml (which sets rustflags and linker config) are absent from the paths filters. Changes to either file would affect compilation/linting results without triggering the CI workflows. (Comments #1, #2, #3, #4)
Required status checks risk: If "Clippy" or "Tests" are configured as required status checks in GitHub branch protection rules, PRs that only touch non-Rust files will have these checks reported as skipped, not passed. GitHub does not treat a skipped check as satisfying a required status check, which would silently block merging for such PRs. (Comments #5, #6)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| paths: | ||
| - "**/*.rs" | ||
| - "**/Cargo.toml" | ||
| - "Cargo.lock" | ||
| - ".github/workflows/clippy.yml" |
There was a problem hiding this comment.
The paths filters also omit .cargo/config.toml, which contains rustflags and linker configurations affecting how the code is compiled. A change to that file could affect clippy and test outcomes without triggering the workflows. Consider adding ".cargo/config.toml" to the paths list.
| paths: | ||
| - "**/*.rs" | ||
| - "**/Cargo.toml" | ||
| - "Cargo.lock" | ||
| - ".github/workflows/clippy.yml" | ||
| pull_request: | ||
| types: [opened, synchronize, reopened, ready_for_review] | ||
| paths: | ||
| - "**/*.rs" | ||
| - "**/Cargo.toml" | ||
| - "Cargo.lock" | ||
| - ".github/workflows/clippy.yml" |
There was a problem hiding this comment.
If the "Tests" or "Clippy" workflows are configured as required status checks in the branch protection rules for main or v*-dev, adding paths filters will cause those checks to be skipped (not reported at all) when a PR only touches non-Rust files (e.g., docs, CI configs, assets). A skipped check does not satisfy a "required" check on GitHub, which would block merging such PRs.
The recommended mitigation is to add a lightweight "pass-through" job that runs when the path filter causes the workflow to be skipped, typically using a separate workflow triggered by workflow_run or by adding a fallback job with if: ${{ !needs.<job>.result }}. Alternatively, use a tool like dorny/paths-filter to conditionally skip individual jobs while keeping the workflow always triggered.
| paths: | |
| - "**/*.rs" | |
| - "**/Cargo.toml" | |
| - "Cargo.lock" | |
| - ".github/workflows/clippy.yml" | |
| pull_request: | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| paths: | |
| - "**/*.rs" | |
| - "**/Cargo.toml" | |
| - "Cargo.lock" | |
| - ".github/workflows/clippy.yml" | |
| pull_request: | |
| types: [opened, synchronize, reopened, ready_for_review] |
| paths: | ||
| - "**/*.rs" | ||
| - "**/Cargo.toml" | ||
| - "Cargo.lock" | ||
| - ".github/workflows/tests.yml" | ||
| pull_request: | ||
| types: [opened, synchronize, reopened, ready_for_review] | ||
| paths: | ||
| - "**/*.rs" | ||
| - "**/Cargo.toml" | ||
| - "Cargo.lock" | ||
| - ".github/workflows/tests.yml" |
There was a problem hiding this comment.
If the "Tests" workflow is configured as a required status check in branch protection rules for main or v*-dev, adding paths filters will cause the check to be skipped (not reported) when a PR only touches non-Rust files. A skipped check does not satisfy a "required" check on GitHub, which would block merging such PRs.
The recommended mitigation is to add a lightweight pass-through job (e.g., always reporting success) for cases where the path filter causes the workflow to be skipped, or to use dorny/paths-filter to conditionally skip individual jobs while always triggering the workflow.
| paths: | ||
| - "**/*.rs" | ||
| - "**/Cargo.toml" | ||
| - "Cargo.lock" | ||
| - ".github/workflows/tests.yml" |
There was a problem hiding this comment.
The paths filters for both workflows omit rust-toolchain.toml, which pins the Rust toolchain version used by CI. A change to that file (e.g., bumping the toolchain version) would affect compilation and lint/test results but would not trigger these workflows. Consider adding "rust-toolchain.toml" to the paths list in both tests.yml and clippy.yml.
Rustflags and linker config changes can affect clippy and test outcomes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Issue being fixed or feature implemented
CI workflows (clippy, tests) run on every push and PR regardless of what changed, wasting runner minutes on non-Rust changes.
What was done?
Added
pathsfilters to bothpushandpull_requesttriggers inclippy.ymlandtests.yml. Workflows now only trigger when:**/*.rs— any Rust source file**/Cargo.toml— any Cargo manifestCargo.lock— dependency lockfile.github/workflows/<self>.yml— the workflow file itselfHow has this been tested?
Verified YAML syntax. Non-functional CI change — no manual test scenarios needed.
Breaking Changes
None
Checklist
🤖 Co-authored by Claudius the Magnificent AI Agent