[CI] Add a prefix to make it nicer to humans when several builds happen. (#11391)
This commit is contained in:
Родитель
2aa6c5aa6b
Коммит
4d93be60c6
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
Загрузка…
Ссылка в новой задаче