From 5408d199eb3a5a282dbb4314ca63921ccdad47d8 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Tue, 20 Apr 2021 15:47:03 -0700 Subject: [PATCH] Sync eng/common directory with azure-sdk-tools for PR 1558 (#2142) --- .../pipelines/templates/steps/set-default-branch.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/eng/common/pipelines/templates/steps/set-default-branch.yml b/eng/common/pipelines/templates/steps/set-default-branch.yml index b66478975..e3eed4512 100644 --- a/eng/common/pipelines/templates/steps/set-default-branch.yml +++ b/eng/common/pipelines/templates/steps/set-default-branch.yml @@ -4,7 +4,12 @@ parameters: steps: - pwsh: | $setDefaultBranch = (git remote show ${{ parameters.RemoteRepo }} | Out-String) -replace "(?ms).*HEAD branch: (\w+).*", '$1' + if ($LASTEXITCODE -ne 0) { + Write-Host "Not able to fetch the default branch from git command. Set to master." + $setDefaultBranch = 'master' + } Write-Host "Setting DefaultBranch=$setDefaultBranch" - echo "##vso[task.setvariable variable=DefaultBranch]$setDefaultBranch" + Write-Host "##vso[task.setvariable variable=DefaultBranch]$setDefaultBranch" displayName: "Setup Default Branch" workingDirectory: ${{ parameters.workingDirectory }} + ignoreLASTEXITCODE: true