Closed RussKie closed 1 year ago
Hi @RussKie, Please post your question on the Developer Community to get the right eyes on it, since this repo is mostly for questions about templates located in this repo.
It seems like SourceVersionAuthor is available only in runtime. You can use conditions like this:
- script: |
echo $(Build.SourceVersionAuthor)
condition: eq(variables['Build.SourceVersionAuthor'], 'dotnet-maestro[bot]')
Thank you @max-zaytsev. That's a bummer really, I hoped I could craft my pipeline a bit more declaratively.
It'd be great to have this documented in https://learn.microsoft.com/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml#build-variables-devops-services too.
Thanks again.
Thank you @RussKie
Yes, I agree. It’s quite difficult to find this information in the documentation. I actually found this statement on the Template types & usage page page.
Only predefined variables can be used in template expressions.
Since Build.SourceVersionAuthor
is not in the list of predefined variables it is an indication that it can’t be used in such expressions.
I couldn't find the information about predefined variables on the Expressions page too. I wish there was some mention of this as well.
I will close this ticket as this issue does not match the current repository and will create an issue in the appropriate repo in order to update the documentation accordingly.
Please let me know if I can help with anything else here.
Thank you!
I need to conditionalise the build based on whether it is a pull-request from a branch name with a specific name submitted by a specific author.
I able to express the first two conditions but I can't figure out the last one. These work
I can use
$(Build.SourceVersionAuthor)
, however, more matter what I do I can't figure out how to apply a condition to it. E.g., none of these work:I can evaluate the whole thing using a script task, but it feels lame...