Skip to content

Commit 84a3ffd

Browse files
authored
Filter out Breaking changes info and return in automation result (#46860)
* skip last line of breaking change log * add log * retrieve breaking change from log
1 parent ed2b3c8 commit 84a3ffd

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

eng/scripts/automation/GenerateAndBuildLib.ps1

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,7 @@ function GeneratePackage()
747747
$artifacts = @()
748748
$apiViewArtifact = ""
749749
$hasBreakingChange = $false
750+
$breakingChangeItems = @()
750751
$content = ""
751752
$result = "succeeded"
752753
$isGenerateSuccess = $true
@@ -860,8 +861,15 @@ function GeneratePackage()
860861
$hasBreakingChange = $false
861862
}
862863
else {
863-
$logFile = Get-Content -Path $logFilePath | select-object -skip 2
864-
$breakingChanges = $logFile -join ",`n"
864+
Write-Host "Breaking changes detected in the build log."
865+
$logFile = Get-Content -Path $logFilePath | select-object -SkipLast 1
866+
$regex = "error( ?):( ?)(?<breakingChange>.*) .*\["
867+
foreach ($line in $logFile) {
868+
if ($line -match $regex) {
869+
$breakingChangeItems += $matches["breakingChange"]
870+
}
871+
}
872+
$breakingChanges = $breakingChangeItems -join ",`n"
865873
$content = "Breaking Changes: $breakingChanges"
866874
$hasBreakingChange = $true
867875
}
@@ -875,6 +883,7 @@ function GeneratePackage()
875883
$changelog = [PSCustomObject]@{
876884
content = $content
877885
hasBreakingChange = $hasBreakingChange
886+
breakingChangeItems = $breakingChangeItems
878887
}
879888

880889
$ciFilePath = "sdk/$service/ci.yml"

0 commit comments

Comments
 (0)