[CI] Do override statuses due to VS Windows using hardcoded strings. (#11762)
This commit is contained in:
Родитель
3eb01e728e
Коммит
7d4c204382
|
@ -152,19 +152,14 @@ function Set-GitHubStatus {
|
||||||
}
|
}
|
||||||
|
|
||||||
$requestContext = $Context
|
$requestContext = $Context
|
||||||
# before we set a status, we are going to check if it is present and a success, if it is a success, do not
|
# Check if the status was already set, if it was we will override yet print a message for the user to know this action was done.
|
||||||
# re-set it. The reason for this is that statuses are linked to the hash of a commit. A commit hash can be in two
|
|
||||||
# different branches. If a hash had a success we will not set the status and we will create a warning and a new context
|
|
||||||
# Why only on success, well we do want to support rebuilds, in any non-success case we want to step over
|
|
||||||
$presentStatuses = Invoke-Request -Request { Invoke-RestMethod -Uri $url -Headers $headers -Method "GET" -ContentType 'application/json' }
|
$presentStatuses = Invoke-Request -Request { Invoke-RestMethod -Uri $url -Headers $headers -Method "GET" -ContentType 'application/json' }
|
||||||
|
|
||||||
# try to find the status with the same context and make a decision, this is not a dict but an array :/
|
# try to find the status with the same context and make a decision, this is not a dict but an array :/
|
||||||
foreach ($s in $presentStatuses) {
|
foreach ($s in $presentStatuses) {
|
||||||
# we found a status from a previous build that was a success, we do not want to step on it
|
# we found a status from a previous build that was a success, we do not want to step on it
|
||||||
if (($s.context -eq $Context) -and ($s.state -eq "success")) {
|
if (($s.context -eq $Context) -and ($s.state -eq "success")) {
|
||||||
Write-Host "WARNING: Not setting status for $Context because it was already set as a success, using '$Context $Env:BUILD_SOURCEBRANCHNAME' instead."
|
Write-Host "WARNING: Found status for $Context because it was already set as a success, overriding result."
|
||||||
# modify the context to include the branch name in the status
|
|
||||||
$requestContext = "$Context $Env:BUILD_SOURCEBRANCHNAME"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче