fix(ci): Only run Swift checks on PRs with Swift changes#250
fix(ci): Only run Swift checks on PRs with Swift changes#250DrunkOnJava merged 2 commits intomainfrom
Conversation
- Check if PR contains Swift file changes before running SwiftLint - Skip Swift-specific checks (TODO/FIXME, security) for non-Swift PRs - Fixes CI failures on workflow-only PRs like #244-#248 This properly handles PRs that only modify workflows, scripts, or documentation without triggering Swift-related validations.
There was a problem hiding this comment.
Pull Request Overview
This PR fixes CI validation issues for non-Swift pull requests by making Swift-specific checks conditional on whether Swift files are actually changed in the PR. Previously, SwiftLint and other Swift checks were running on all PRs regardless of file types changed, causing workflow-only and documentation PRs to fail due to existing SwiftLint violations.
Key changes:
- Added a check to detect if Swift files are modified in the PR before running Swift-specific validations
- Made SwiftLint, TODO/FIXME checks, and security checks conditional on Swift file changes
- Added Xcode diagnostics configuration file
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
.github/workflows/pr-validation.yml |
Modified to conditionally run Swift checks only when Swift files are changed in the PR |
.xcode-diagnostics.json |
Added new configuration file for Xcode build diagnostics and thresholds |
.github/sync-status/local-push.json |
Added sync status tracking file for the current branch |
| - name: Check for TODO and FIXME comments | ||
| if: steps.check_swift.outputs.is_swift == 'true' | ||
| if: steps.check_swift_changes.outputs.has_swift_changes == 'true' |
There was a problem hiding this comment.
This condition references steps.check_swift_changes but the step with id check_swift_changes is defined in a different job. The TODO/FIXME check job needs to either have its own Swift file detection step or reference the correct step id from the current job context.
|
|
||
| - name: Security checks | ||
| if: steps.check_swift.outputs.is_swift == 'true' | ||
| if: steps.check_swift_changes.outputs.has_swift_changes == 'true' |
There was a problem hiding this comment.
This condition references steps.check_swift_changes but the step with id check_swift_changes is defined in a different job. The security checks job needs to either have its own Swift file detection step or reference the correct step id from the current job context.
🔍 PR Validation ResultsBuild Status: ❌ Failed This comment was automatically generated by the PR validation workflow. |
The check_swift step needs to use the has_swift_changes output to avoid trying to generate Xcode projects for non-Swift PRs.
🔍 PR Validation ResultsBuild Status: ✅ Passed This comment was automatically generated by the PR validation workflow. |
🐛 Fix PR Validation for Non-Swift PRs
Problem
PR #249 partially fixed the issue but SwiftLint was still running on all Swift files in the repository, not just checking if Swift files were changed in the PR. This caused PRs #244-#248 (which only contain workflow/script changes) to fail CI due to existing SwiftLint violations in the codebase.
Solution
Impact
This will allow workflow-only, script-only, and documentation-only PRs to pass CI without being blocked by Swift linting issues.
Testing
After this is merged, PRs #244-#248 should pass CI when rebased.
Fixes the remaining CI issues for #244, #245, #246, #247, #248