Following script works if BuildReason is defined as user defined variable within the yml file. Would it be possible to get its value if it is set as environment variable directly on the UI?
trigger: none
name: $(Date:yyyy).$(Date:MMdd).$(Rev:r)
variables:
- name: templateName
${{ if eq( variables['BuildReason'], 'PR' ) }}:
value: 'pipelines/prvalidation-template.yml'
${{ else }}:
value: 'pipelines/build-template.yml'
extends:
template: ${{ variables.templateName }}
parameters:
Parameter1: MyProject
Thank you!
There is predefined variable Build.Reason
which you can use in expressions.