diff --git a/utils/appveyor-killold.ps1 b/utils/appveyor-killold.ps1 index 28e02c42d85..308b0760717 100644 --- a/utils/appveyor-killold.ps1 +++ b/utils/appveyor-killold.ps1 @@ -10,10 +10,11 @@ # The AppVeyor 'rollout builds' option is supposed to serve the same # purpose but it is problematic because it tends to cancel builds pushed # directly to master instead of just PR builds (or the converse). -# credits: JuliaLang developers. -$_NEWEST = "https://ci.appveyor.com/api/projects/${env:APPVEYOR_ACCOUNT_NAME}/${env:APPVEYOR_PROJECT_SLUG}/history?recordsNumber=50" -$_NEWEST = ((Invoke-RestMethod $_NEWEST).builds | Where-Object pullRequestId) -$_NEWEST = ($_NEWEST -Eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber -if ($env:APPVEYOR_PULL_REQUEST_NUMBER -And $env:APPVEYOR_BUILD_NUMBER -Ne $_NEWEST) { +# reference: +# JuliaLang developers +# (https://github.com/JuliaLang/Example.jl/commit/8a4959122ce843b3664337c8b5119ce3a968c408) +if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod + https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | + Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { throw "There are newer queued builds for this pull request, failing early." }