How do we read GIT commit message inside an Azure DevOps build pipeline?

Viewed 3392

Is it possible to read the actual GIT commit message inside an Azure build pipeline?

1 Answers

You have a pre-defined variable with the commit message:

Build.SourceVersionMessage  

The comment of the commit or changeset for the triggering repo. This variable is agent-scoped, and can be used as an environment variable in a script and as a parameter in a build task, but not as part of the build number or as a version control tag. Also, this variable is only available on the step level and is neither available in the job nor stage levels (i.e. the message is not extracted until the job had started and checked out the code).

Related