@@ -41,11 +41,26 @@ steps:
4141 pwsh : true
4242 workingDirectory : ' ${{ parameters.WorkingDirectory }}'
4343
44+ - task : Powershell@2
45+ displayName : Save package properties filtered for PR
46+ inputs :
47+ filePath : ${{ parameters.ScriptDirectory }}/Save-Package-Properties.ps1
48+ arguments : >
49+ -PrDiff '${{ parameters.DiffDirectory }}/diff.json'
50+ -OutDirectory '${{ parameters.PackageInfoDirectory }}'
51+ pwsh : true
52+ workingDirectory : ' ${{ parameters.WorkingDirectory }}'
53+
4454 # When running in PR mode, we want the detected changed services to be attached to the build as tags.
4555 # However, the public identity does not have the permissions to attach tags to the build.
4656 # Instead, we will save the changed services to a file, attach it as an attachment for PiplineWitness to pick up and utilize.
57+ #
4758 - pwsh : |
48- $changedServices = (Get-Content -Path '${{ parameters.DiffDirectory }}/diff.json' -Raw | ConvertFrom-Json).ChangedServices
59+ $changedPackages = Get-ChildItem -Recurse -Filter *.json "${{ parameters.PackageInfoDirectory }}" `
60+ | ForEach-Object { Get-Content -Raw $_ | ConvertFrom-Json }
61+
62+ $changedServices = $changedPackages | Where-Object { $_.IncludedForValidation -eq $false } `
63+ | Select-Object -ExpandProperty ServiceDirectory | Sort-Object -Unique
4964
5065 if ($changedServices) {
5166 Write-Host "Attaching changed service names to the build for additional tag generation."
@@ -55,15 +70,6 @@ steps:
5570 displayName: Upload tags.json with changed services
5671 workingDirectory: '${{ parameters.WorkingDirectory }}'
5772
58- - task : Powershell@2
59- displayName : Save package properties filtered for PR
60- inputs :
61- filePath : ${{ parameters.ScriptDirectory }}/Save-Package-Properties.ps1
62- arguments : >
63- -PrDiff '${{ parameters.DiffDirectory }}/diff.json'
64- -OutDirectory '${{ parameters.PackageInfoDirectory }}'
65- pwsh : true
66- workingDirectory : ' ${{ parameters.WorkingDirectory }}'
6773 - ${{ else }} :
6874 - task : Powershell@2
6975 displayName : Save package properties
0 commit comments