ci: allow Swift SDK build to run when Rust tests are skipped#3351
Conversation
The swift-sdk-build job depends on rs-workspace-tests, but when a PR only changes Swift files (no Rust changes), rs-workspace-tests skips entirely. GitHub Actions propagates the skip to all downstream jobs, so the Swift build never runs even though swift-sdk-changed is true. Fix: use always() with explicit failure checks so the Swift build runs when Rust tests skip (Swift-only PRs) or pass, but still blocks when Rust tests fail or change detection fails. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughUpdated the Swift SDK build workflow condition to include multiple guards: always evaluation, verification that Swift SDK files changed, and checks ensuring prior job steps did not fail. This prevents unnecessary builds while preserving existing triggers. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 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)
📝 Coding Plan
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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## v3.1-dev #3351 +/- ##
=========================================
Coverage 75.66% 75.66%
=========================================
Files 3000 3000
Lines 275571 275571
=========================================
+ Hits 208501 208509 +8
+ Misses 67070 67062 -8
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.github/workflows/tests.yml (1)
204-204: Tighten upstream result checks to avoid running after cancellations.On line 204, the condition uses
!= 'failure', which allows jobs withcancelledstatus to pass. Ifrs-workspace-testsis cancelled,swift-sdk-buildcan still run. Use explicit allowlisting of expected states instead.Proposed condition update
- if: ${{ always() && needs.changes.outputs.swift-sdk-changed == 'true' && needs.changes.result != 'failure' && needs.rs-workspace-tests.result != 'failure' }} + if: ${{ always() && needs.changes.outputs.swift-sdk-changed == 'true' && needs.changes.result == 'success' && (needs.rs-workspace-tests.result == 'success' || needs.rs-workspace-tests.result == 'skipped') }}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/tests.yml at line 204, The if expression currently uses "!= 'failure'" which lets cancelled upstream jobs pass; update the condition so both needs.changes.result and needs.rs-workspace-tests.result are explicit allowlisted states (e.g., change "needs.changes.result != 'failure'" and "needs.rs-workspace-tests.result != 'failure'" to "needs.changes.result == 'success'" and "needs.rs-workspace-tests.result == 'success'") so swift-sdk-build only runs when the upstream jobs succeeded.
🤖 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/tests.yml:
- Line 204: The if expression currently uses "!= 'failure'" which lets cancelled
upstream jobs pass; update the condition so both needs.changes.result and
needs.rs-workspace-tests.result are explicit allowlisted states (e.g., change
"needs.changes.result != 'failure'" and "needs.rs-workspace-tests.result !=
'failure'" to "needs.changes.result == 'success'" and
"needs.rs-workspace-tests.result == 'success'") so swift-sdk-build only runs
when the upstream jobs succeeded.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 7f9c6254-b528-4ecf-b901-9f33c0448e29
📒 Files selected for processing (1)
.github/workflows/tests.yml
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
Details
The
swift-sdk-buildjob depends onrs-workspace-tests. When a PR only changes Swift files,rs-workspace-testsskips (no Rust changes detected). GitHub Actions propagates the skip to all downstreamneedsjobs, so Swift build never runs — even thoughswift-sdk-changedistrue.Before: Swift-only PRs like #3079 skip the Swift build entirely
After: Swift build runs when Rust tests skip or pass, blocks only on Rust test failure
The fix uses
always()with explicit failure guards:Test plan
🤖 Generated with Claude Code
Summary by CodeRabbit