I would like to have something like this:
- ${{ if or(eq(parameters.RunTestsOnPRBuildOnly, false), eq(variables.Build.Reason, 'PullRequest')) }}:
- template: ps-module-run-tests.yml
This does not work, as variables.Build.Reason
is empty. Is it possible at all?
Note that I know how to modify the ps-module-run-tests.yml
template to express my desire as a runtime condition. In other words I know how to arrive at this:
What I am curious is whether Build.Reason
can be used in a compile time condition, so that these steps are not even rendered. On the surface, there is no inherent problem with that, because the value is known right at the start, but it depends on when the template is compiled. If too early, then it is impossible, but I am unaware of such details. Maybe I cannot do it, because I am missing something.
So, is it possible?