diff --git a/.azure-pipelines/scripts/switch-branch.ps1 b/.azure-pipelines/scripts/switch-branch.ps1 new file mode 100644 index 0000000000..a3bfda75d6 --- /dev/null +++ b/.azure-pipelines/scripts/switch-branch.ps1 @@ -0,0 +1,8 @@ +git config user.email "azure-pipelines-bot@microsoft.com" +git config user.name "azure-pipelines-bot" + +git checkout -f origin/$env:TARGET_BRANCH + +if ($LASTEXITCODE -ne 0){ + Write-Error "git checkout failed with exit code $LASTEXITCODE" -ErrorAction Stop +} diff --git a/.vsts.release.yml b/.vsts.release.yml index e6368c6960..9784793a72 100644 --- a/.vsts.release.yml +++ b/.vsts.release.yml @@ -172,10 +172,10 @@ extends: - checkout: self clean: true - - task: Bash@3 + - task: PowerShell@2 displayName: Switch to release branch inputs: - filePath: .azure-pipelines/scripts/switch-branch.sh + filePath: .azure-pipelines/scripts/switch-branch.ps1 env: TARGET_BRANCH: $(ReleaseBranch)