summaryrefslogtreecommitdiff
path: root/.github/scripts
diff options
context:
space:
mode:
authorAdonais Romero Gonzalez <[email protected]>2022-09-26 16:04:27 -0700
committerAdonais Romero Gonzalez <[email protected]>2022-09-26 16:04:27 -0700
commitb6812b8d510dd8f23da7703506cb67cefc985533 (patch)
tree83057821801d7f9a9c274834a973e9abd8c07aa0 /.github/scripts
parent78a4097df51c69947516fff09abf1444eebe70c2 (diff)
parent239361d9ab5c4b2098896f7a29451b99b71d9063 (diff)
Merge branch 'main' into develop
Diffstat (limited to '.github/scripts')
-rw-r--r--.github/scripts/Build-ChangedProjects.ps134
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..a13e3501
--- /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 "`u{2754} 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 "`u{2754} Changed file $file does not match a project."
+ continue
+ }
+ $projectName = $dir.Replace($root, '').Trim('\').Replace('\', '.').ToLower()
+ Write-Output "`u{1F50E} Found project [$projectName] at $dir from changed file $file"
+ if (-not ($projectSet.ContainsKey($projectName)))
+ {
+ $projectSet[$projectName] = $dir
+ }
+}
+
+.\Build-ProjectSet -ProjectSet $projectSet
+