diff --git a/tools/devops/automation/scripts/GitHub.psm1 b/tools/devops/automation/scripts/GitHub.psm1 index 2210224a95a1..a73443d970ef 100644 --- a/tools/devops/automation/scripts/GitHub.psm1 +++ b/tools/devops/automation/scripts/GitHub.psm1 @@ -381,7 +381,7 @@ function New-GitHubSummaryComment { $TestSummaryPath, [string] - $Artifacts + $Artifacts="" ) $envVars = @{ @@ -410,7 +410,8 @@ function New-GitHubSummaryComment { # we did generate an index with the files in vsdrops $sb.AppendLine("* [Html Report (VSDrops)]($Env:VSDROPS_INDEX)") } - if ($Artifacts) { + if (-not [string]::IsNullOrEmpty($Artifacts)) { + Write-Host "Parsing artifacts" if (-not (Test-Path $Artifacts -PathType Leaf)) { $sb.AppendLine("Path $Artifacts was not found!") } else { @@ -418,12 +419,19 @@ function New-GitHubSummaryComment { $json = Get-Content $Artifacts | ConvertFrom-Json if ($json.Count -gt 0) { $sb.AppendLine("
View packages") + $sb.AppendLine("") # no new line results in a bad rendering in the links foreach ($a in $json) { $url = $a.url if ($url.EndsWith(".pkg") -or $url.EndsWith(".nupkg")) { try { - $fileName = $a.url.Substring($a.url.LastIndexOf("/" + 1)) - $sb.AppendLine("* [$fileName]($($a.url))") + $fileName = $a.url.Substring($a.url.LastIndexOf("/") + 1) + Write-Host "Adding link for $fileName" + if ($a.url.Contains("notarized")) { + $link = "* [$fileName (notarized)]($($a.url))" + } else { + $link = "* [$fileName]($($a.url))" + } + $sb.AppendLine($link) } catch { Write-Host "Could not get file name for url $url" } @@ -434,6 +442,8 @@ function New-GitHubSummaryComment { $sb.AppendLine("No packages found.") } } + } else { + Write-Host "Artifacts were not provided." } $headerLinks = $sb.ToString() diff --git a/tools/devops/automation/templates/build/publish-html.yml b/tools/devops/automation/templates/build/publish-html.yml index c178b0c86de9..809d852155ff 100644 --- a/tools/devops/automation/templates/build/publish-html.yml +++ b/tools/devops/automation/templates/build/publish-html.yml @@ -79,7 +79,11 @@ steps: $env:VSDROPS_INDEX="$Env:VSDROPSPREFIX/$Env:BUILD_BUILDNUMBER/$Env:BUILD_BUILDID/$Env:DEVICE_PREFIX/;/tests/vsdrops_index.html" Import-Module $Env:SYSTEM_DEFAULTWORKINGDIRECTORY\xamarin-macios\tools\devops\automation\scripts\GitHub.psm1 Import-Module $Env:SYSTEM_DEFAULTWORKINGDIRECTORY\xamarin-macios\tools\devops\automation\scripts\VSTS.psm1 - if ($Env:BUILD_PACKAGE -eq "True") { + + $buildReason = "$(Build.Reason)" + $buildSourceBranchName = "$(Build.SourceBranchName)" + + if ($buildReason -ne "PullRequest" -or $Env:BUILD_PACKAGE -eq "True") { Write-Host "Json path is $Env:ARTIFACTS_JSON_PATH" $response = New-GitHubSummaryComment -Context "$Env:CONTEXT" -TestSummaryPath "$Env:TESTS_SUMMARY" -Artifacts "$Env:ARTIFACTS_JSON_PATH" Write-Host $response