Skip to content

Commit f746a2a

Browse files
azure-sdksima-zhu
andauthored
Sync eng/common directory with azure-sdk-tools for PR 1558 (Azure#18178)
* Set default branch to master if not set from git * Added log messages * Silent the failure if not able fetch default branch from git * Update git-push-changes.yml Co-authored-by: Sima Zhu <sizhu@microsoft.com> Co-authored-by: Sima Zhu <48036328+sima-zhu@users.noreply.github.com>
1 parent 839229a commit f746a2a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

eng/common/pipelines/templates/steps/set-default-branch.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ parameters:
44
steps:
55
- pwsh: |
66
$setDefaultBranch = (git remote show ${{ parameters.RemoteRepo }} | Out-String) -replace "(?ms).*HEAD branch: (\w+).*", '$1'
7+
if ($LASTEXITCODE -ne 0) {
8+
Write-Host "Not able to fetch the default branch from git command. Set to master."
9+
$setDefaultBranch = 'master'
10+
}
711
Write-Host "Setting DefaultBranch=$setDefaultBranch"
8-
echo "##vso[task.setvariable variable=DefaultBranch]$setDefaultBranch"
12+
Write-Host "##vso[task.setvariable variable=DefaultBranch]$setDefaultBranch"
913
displayName: "Setup Default Branch"
1014
workingDirectory: ${{ parameters.workingDirectory }}
15+
ignoreLASTEXITCODE: true

0 commit comments

Comments
 (0)