Within my YML file I am using a patch variable with a counter to have separate patch numbers based on pull request build and not-PR
patch: $[counter(format('{0}-{1}', ne(variables['Build.Reason'], 'PullRequest'), variables['minor']), 0)] # True for CI/Manual. False for PR.
Now this is somewhat confusing as my PR/not-PR build numbers will overlap and PR numbers will eventually race ahead
How can I say set my major version to 0 if the Build Reason is PR? I will need to do this on the variable declaration rather than in a script so the visible build number is 0.1.x
Something like this maybe??
major: $[if (ne(variables['Build.Reason'], 'PullRequest')), '1', '0']
The documentation appears somewhat limited, but I assume there is a way?