[release/v7.5] Fix merge conflict checker for empty file lists and filter *.cs files (#26813)

This commit is contained in:
Dongbo Wang
2026-02-13 15:24:41 -08:00
committed by GitHub
parent 914288e476
commit 2c5fdfb30e
4 changed files with 77 additions and 14 deletions
@@ -56,8 +56,10 @@ jobs:
- **File Handling**:
- Checks only files that were added, modified, or renamed
- Skips deleted files
- **Filters out `*.cs` files** (C# files are excluded from merge conflict checking)
- Skips binary/unreadable files
- Skips directories
- **Empty File List**: Gracefully handles cases where no files need checking (e.g., PRs that only delete files)
## Example Output
@@ -25,7 +25,8 @@ runs:
run: |
# Get changed files from environment variable (secure against injection)
$changedFilesJson = $env:CHANGED_FILES_JSON
$changedFiles = $changedFilesJson | ConvertFrom-Json
# Ensure we always have an array (ConvertFrom-Json returns null for empty JSON arrays)
$changedFiles = @($changedFilesJson | ConvertFrom-Json)
# Import ci.psm1 and run the check
Import-Module "$env:GITHUB_WORKSPACE/tools/ci.psm1" -Force