[release/v7.4] Fix merge conflict checker for empty file lists and filter *.cs files#26387
Merged
TravisEz13 merged 1 commit intoPowerShell:release/v7.4from Nov 5, 2025
Merged
Conversation
…PowerShell#26365) Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: TravisEz13 <[email protected]>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the Test-MergeConflictMarker function to gracefully handle edge cases in merge conflict detection, specifically addressing scenarios where PRs have no files to check (e.g., delete-only PRs) and excluding C# files from conflict marker checking.
Key changes:
- Modified the
$Fileparameter to accept empty arrays by removing theMandatoryattribute and adding[AllowEmptyCollection()] - Added logic to filter out
*.csfiles from merge conflict checking with appropriate user feedback - Implemented a helper function
Write-NoFilesOutputto standardize output when no files require checking - Updated tests to verify the new behavior for empty file arrays
- Ensured the GitHub Action properly handles empty JSON arrays by wrapping
ConvertFrom-Jsonoutput in@()
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tools/ci.psm1 | Enhanced Test-MergeConflictMarker to accept empty file arrays, filter out C# files, and handle edge cases with appropriate output generation |
| test/infrastructure/ciModule.Tests.ps1 | Updated test to verify graceful handling of empty file arrays instead of expecting an error |
| .github/actions/infrastructure/merge-conflict-checker/action.yml | Added array wrapping to handle empty JSON arrays from ConvertFrom-Json |
| .github/actions/infrastructure/merge-conflict-checker/README.md | Documented the C# file filtering behavior and empty file list handling |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
daxian-dbw
approved these changes
Nov 5, 2025
adityapatwardhan
approved these changes
Nov 5, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #26365 to release/v7.4
Triggered by @TravisEz13 on behalf of @copilot
Original CL Label: CL-Test
/cc @PowerShell/powershell-maintainers
Impact
Tooling Impact
This backport fixes the merge conflict checker script in CI to properly handle empty file lists and filter C# files. The original PR fixed issues where the script would fail when no files matched certain patterns, causing false positives in merge conflict detection.
Regression
This is a fix for tooling, not a regression fix.
Testing
The fix was tested in the original PR #26365 where it resolved issues with the merge conflict checker script failing on empty file lists. The changes ensure the script properly handles edge cases:
Risk
This is a low-risk change as it only affects CI tooling scripts used for merge conflict detection. The changes improve the robustness of the checker by handling edge cases that previously caused false failures. The fix does not affect runtime PowerShell functionality or user-facing features.