Search code examples
azure-devopsazure-pipelinesdevopstfvc

Build pipeline - Get title of check-in that triggered pipeline


I'm creating a new build pipeline, it will be triggered on a new check-in on a specific branch on a TFVC repository. I want to get the title of the check-in every time the pipeline triggers and store it in the variables.

Additionally, after getting the title I want to perform some checks and depending on the result ( e.g. title matches a specific template) either stop the build pipeline or move on to the next steps

I've looked in Variables and Triggers tabs, but I didn't find anything useful. I've also looked in the predefined variables, but I didn't find anything related to my issue either.


Solution

  • You can try this variable Build.SourceVersion to get the number and Build.SourceVersionMessage to get the comments.

    Build.SourceVersionMessage The comment of the commit or changeset. Note: This variable is available from TFS 2015.4.

    See also: https://learn.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml