diff --git a/tools/devops/automation/scripts/GitHub.psm1 b/tools/devops/automation/scripts/GitHub.psm1 index 2a0539e2fe..45c38dcfad 100644 --- a/tools/devops/automation/scripts/GitHub.psm1 +++ b/tools/devops/automation/scripts/GitHub.psm1 @@ -569,17 +569,25 @@ function New-GitHubSummaryComment { $statusContext = "$Contex - $Env:BUILD_DEFINITIONNAME) (Test run)" } + # make a diff between a PR and a CI build so that users do not get confused. + $prefix = ""; + if ([string]::IsNullOrEmpty($Env:PR_ID)) { + $prefix = "[CI Build]" + } else { + $prefix = "[PR Build]" + } + if (-not (Test-Path $TestSummaryPath -PathType Leaf)) { Write-Host "No test summary found" - Set-GitHubStatus -Status "failure" -Description "Tests failed catastrophically on $Context (no summary found)." -Context $statusContext + Set-GitHubStatus -Status "failure" -Description "$prefix Tests failed catastrophically on $Context (no summary found)." -Context $statusContext $request = New-GitHubComment -Header "Tests failed catastrophically on $Context (no summary found)." -Emoji ":fire:" -Description "Result file $TestSummaryPath not found. $headerLinks" } else { if (Test-JobSuccess -Status $Env:TESTS_JOBSTATUS) { Set-GitHubStatus -Status "success" -Description "All tests passed on $Context." -Context $statusContext - $request = New-GitHubCommentFromFile -Header "Tests passed on $Context." -Description "Tests passed on $Context. $headerLinks" -Emoji ":white_check_mark:" -Path $TestSummaryPath + $request = New-GitHubCommentFromFile -Header "$prefix Tests passed on $Context." -Description "Tests passed on $Context. $headerLinks" -Emoji ":white_check_mark:" -Path $TestSummaryPath } else { Set-GitHubStatus -Status "error" -Description "Tests failed on $Context." -Context $statusContext - $request = New-GitHubCommentFromFile -Header "Tests failed on $Context" -Description "Tests failed on $Context. $headerLinks" -Emoji ":x:" -Path $TestSummaryPath + $request = New-GitHubCommentFromFile -Header "$prefix Tests failed on $Context" -Description "Tests failed on $Context. $headerLinks" -Emoji ":x:" -Path $TestSummaryPath } } return $request diff --git a/tools/devops/automation/templates/build/stage.yml b/tools/devops/automation/templates/build/stage.yml index 1a80f29155..563debee22 100644 --- a/tools/devops/automation/templates/build/stage.yml +++ b/tools/devops/automation/templates/build/stage.yml @@ -165,6 +165,7 @@ jobs: TESTS_JOBSTATUS: $[ dependencies.build.outputs['runTests.TESTS_JOBSTATUS'] ] APIDIFF_MESSAGE: $[ dependencies.build.outputs['apidiff.APIDIFF_MESSAGE'] ] APIDIFF_BUILT: $[ dependencies.build.outputs['apidiff.APIDIFF_BUILT'] ] + PR_ID: $[ dependencies.configure.outputs['labels.pr-number'] ] pool: vmImage: 'windows-latest' workspace: