ci: skip expensive jobs on docs/planning-only PRs#195
Conversation
Add dorny/paths-filter to detect changed paths and conditionally skip heavy CI jobs (tests, builds, desktop builds) when only docs/planning files change. Lint and typecheck always run. Push to main always runs all jobs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
WalkthroughThe changes introduce path-based filtering to two CI workflows using dorny/paths-filter. A new "Detect Changes" job categorizes modifications into src and desktop streams, with downstream jobs conditionally executing only when relevant changes are detected or on manual/push events, reducing unnecessary workflow runs. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Entire-Checkpoint: b28daa873b9e
There was a problem hiding this comment.
🧹 Nitpick comments (2)
.github/workflows/ci.yml (1)
81-85: Inconsistentifguard:api-specis missing the!failure() && !cancelled()check.All other gated jobs (
test,build,cargo-check-*,build-desktop-*) use the!failure() && !cancelled()prefix in theirifconditions, butapi-specdoes not. Sinceapi-speconly depends onchanges, the practical impact is minimal — however, ifchangeswere to fail on apushevent,api-specwould still attempt to run (becausegithub.event_name == 'push'is true), whereas the intent would typically be to skip.For consistency and defensive correctness:
Suggested fix
api-spec: name: Verify API Spec & Client needs: [changes] if: | - github.event_name == 'push' || needs.changes.outputs.src == 'true' + !failure() && !cancelled() && + (github.event_name == 'push' || needs.changes.outputs.src == 'true')🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/ci.yml around lines 81 - 85, The api-spec job's if guard lacks the defensive prefix used elsewhere; update the api-spec job (identifier: api-spec) to prepend the same !failure() && !cancelled() check to its existing condition so it becomes: evaluate !failure() && !cancelled() first and then permit the job when either github.event_name == 'push' or needs.changes.outputs.src == 'true' — ensure proper parentheses/grouping around the OR expression to preserve logic..github/workflows/e2e.yml (1)
11-33: Thesrcfilter is duplicated fromci.yml.The filter definition is identical to the one in
ci.yml(lines 24-33). If a new docs/planning directory is added to the repo, both files need to be updated in sync. This is a known limitation of GitHub Actions. Consider extracting this into a reusable workflow that both workflows call, or at minimum add a comment in each file referencing the other to keep them in sync.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/e2e.yml around lines 11 - 33, The "src" paths-filter block duplicated in the Detect Changes workflow (steps using dorny/paths-filter with id: filter and outputs.src) should be centralized; either extract the filters block into a reusable workflow that both this workflow (name: Detect Changes) and ci.yml call, or at minimum add a clear comment in this workflow near the dorny/paths-filter step referencing ci.yml so future changes stay in sync; update the step using id: filter to call the new reusable workflow (or leave it but add the cross-reference comment) and ensure outputs.src remains wired to the step outputs.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In @.github/workflows/ci.yml:
- Around line 81-85: The api-spec job's if guard lacks the defensive prefix used
elsewhere; update the api-spec job (identifier: api-spec) to prepend the same
!failure() && !cancelled() check to its existing condition so it becomes:
evaluate !failure() && !cancelled() first and then permit the job when either
github.event_name == 'push' or needs.changes.outputs.src == 'true' — ensure
proper parentheses/grouping around the OR expression to preserve logic.
In @.github/workflows/e2e.yml:
- Around line 11-33: The "src" paths-filter block duplicated in the Detect
Changes workflow (steps using dorny/paths-filter with id: filter and
outputs.src) should be centralized; either extract the filters block into a
reusable workflow that both this workflow (name: Detect Changes) and ci.yml
call, or at minimum add a clear comment in this workflow near the
dorny/paths-filter step referencing ci.yml so future changes stay in sync;
update the step using id: filter to call the new reusable workflow (or leave it
but add the cross-reference comment) and ensure outputs.src remains wired to the
step outputs.
Summary
dorny/paths-filter@v3to both CI and E2E workflows to detect what changedapps/desktop/,packages/crypto/, or the CI workflow itself changesmainandworkflow_dispatchalways run all jobs as a safety netTest plan
ci.ymlso all jobs should run (validates workflow syntax).mdfiles🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes