@@ -41,11 +41,26 @@ steps:
41
41
pwsh : true
42
42
workingDirectory : ' ${{ parameters.WorkingDirectory }}'
43
43
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
+
44
54
# When running in PR mode, we want the detected changed services to be attached to the build as tags.
45
55
# However, the public identity does not have the permissions to attach tags to the build.
46
56
# Instead, we will save the changed services to a file, attach it as an attachment for PiplineWitness to pick up and utilize.
57
+ #
47
58
- 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
49
64
50
65
if ($changedServices) {
51
66
Write-Host "Attaching changed service names to the build for additional tag generation."
@@ -55,15 +70,6 @@ steps:
55
70
displayName: Upload tags.json with changed services
56
71
workingDirectory: '${{ parameters.WorkingDirectory }}'
57
72
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 }}'
67
73
- ${{ else }} :
68
74
- task : Powershell@2
69
75
displayName : Save package properties
0 commit comments