Skip to content

Commit f08c94f

Browse files
committed
Ensure we have the branchName for both mainline pushes and merging pull requests.
1 parent d058daf commit f08c94f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

azure-pipelines.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ variables:
7070
value: '$(Build.QueuedBy)'
7171
- name: 'timestamper'
7272
value: ${{ parameters.timestamper }}
73+
- ${{ if startsWith(variables['Build.SourceBranch'], 'refs/heads/') }}:
74+
- name: 'branchName'
75+
value: $[ replace(variables['Build.SourceBranch'], 'refs/heads/', '') ]
76+
- ${{ if startsWith(variables['Build.SourceBranch'], 'refs/pull/') }}:
77+
- name: 'branchName'
78+
value: $[ replace(variables['System.PullRequest.TargetBranch'], 'refs/heads/', '') ]
7379

7480
steps:
7581
- checkout: self

0 commit comments

Comments
 (0)