Skip to content

fix(ci): Only run Swift checks on PRs with Swift changes#250

Merged
DrunkOnJava merged 2 commits intomainfrom
fix/pr-validation-check-changed-files
Jul 31, 2025
Merged

fix(ci): Only run Swift checks on PRs with Swift changes#250
DrunkOnJava merged 2 commits intomainfrom
fix/pr-validation-check-changed-files

Conversation

@DrunkOnJava
Copy link
Owner

🐛 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

  • Check if the PR contains Swift file changes before running SwiftLint
  • Skip Swift-specific checks (TODO/FIXME, security) for non-Swift PRs
  • Only run these checks when Swift files are actually modified in the PR

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

- 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.
Copilot AI review requested due to automatic review settings July 31, 2025 23:00
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment on lines 160 to +161
- 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'
Copy link

Copilot AI Jul 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.

- name: Security checks
if: steps.check_swift.outputs.is_swift == 'true'
if: steps.check_swift_changes.outputs.has_swift_changes == 'true'
Copy link

Copilot AI Jul 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link

🔍 PR Validation Results

Build Status: ❌ Failed
SwiftLint: ⚠️ Issues found
Project Structure: ❌ Issues found
Compilation: ❌ 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.
@github-actions
Copy link

🔍 PR Validation Results

Build Status: ✅ Passed
SwiftLint: ⚠️ Issues found
Project Structure: ❌ Issues found
Compilation: ❌ Failed


This comment was automatically generated by the PR validation workflow.

@DrunkOnJava DrunkOnJava merged commit 5a60bfc into main Jul 31, 2025
2 of 4 checks passed
@DrunkOnJava DrunkOnJava deleted the fix/pr-validation-check-changed-files branch July 31, 2025 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants