diff options
Diffstat (limited to '.github/scripts')
| -rw-r--r-- | .github/scripts/Build-ChangedProjects.ps1 | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/.github/scripts/Build-ChangedProjects.ps1 b/.github/scripts/Build-ChangedProjects.ps1 new file mode 100644 index 00000000..e163e5f9 --- /dev/null +++ b/.github/scripts/Build-ChangedProjects.ps1 @@ -0,0 +1,34 @@ +param ( + [array]$ChangedFiles +) + +$root = (Get-Location).Path + +# To include in CI gate +$projectSet = @{} +foreach ($file in $ChangedFiles) +{ + if (-not (Test-Path $file)) { + Write-Output "❔ Changed file $file cannot be found" + continue + } + $dir = (Get-Item $file).DirectoryName + while ((-not ($slnItems = (Get-ChildItem $dir '*.sln'))) -and ($dir -ne $root)) + { + $dir = (Get-Item $dir).Parent.FullName + } + if ($dir -eq $root) + { + Write-Output "❔ Changed file $file does not match a project." + continue + } + $projectName = $dir.Replace($root, '').Trim('\').Replace('\', '.').ToLower() + Write-Output "🔎 Found project [$projectName] at $dir from changed file $file" + if (-not ($projectSet.ContainsKey($projectName))) + { + $projectSet[$projectName] = $dir + } +} + +.\Build-ProjectSet -ProjectSet $projectSet + |
