[devops] Only fetch the exact remote branches we need to undo the GitHub merge. (#21266)
This will typically save between 1 and 2 minutes for every test run. But potentially much more if GitHub happens to be slow: ``` [...] Working on a PR, Undoing the github merge with main. ##[error]The task has timed out. [...] ```
This commit is contained in:
Родитель
6df33a86bb
Коммит
852496d5de
|
@ -11,8 +11,11 @@ param
|
|||
if($IsPr.ToLower() -eq "true") {
|
||||
Write-Host "Working on a PR, Undoing the github merge with main."
|
||||
|
||||
git config remote.origin.fetch '+refs/pull/*:refs/remotes/origin/pull/*'
|
||||
git fetch origin
|
||||
$refspec="+refs/pull/$Env:SYSTEM_PULLREQUEST_PULLREQUESTNUMBER/*:refs/remotes/origin/pull/$Env:SYSTEM_PULLREQUEST_PULLREQUESTNUMBER/*"
|
||||
|
||||
Write-Host "Refspec: $refspec"
|
||||
|
||||
git fetch origin "$refspec"
|
||||
|
||||
$branch="$SourceBranch".Replace("merge", "head")
|
||||
$branch=$branch.Replace("refs", "origin")
|
||||
|
|
Загрузка…
Ссылка в новой задаче