Reputation: 2900
In AppVeyor we get the extended part of the Git commit message using the APPVEYOR_REPO_COMMIT_MESSAGE_EXTENDED
environment variable, but I can't see an equivalent in Azure Pipelines.
If I create a bash
step containing printenv | sort
to view all the available environment variables in my YAML pipeline then the output indicates that the BUILD_SOURCEVERSIONMESSAGE
only contains the first line of the commit message, and no EXTENDED
equivalent exists. I can't see anything in the docs either. Our repo is hosted in GitHub rather than in Azure DevOps if this makes a difference.
Is possible to get the extended commit message in an Azure Pipeline?
Upvotes: 2
Views: 679
Reputation: 2900
I've worked out an alternative way to get what I needed. The following line (in powershell) assigns the most recent commit message to $commitMessageFull
as an array of strings, one string per line.
$commitMessageFull = git log -1 --pretty=%B
You can then split the first line and the extended message out with this:
$first, $extended = $commitMessageFull
The $first
variable now contains a single string which is the first line of the commit message, and $extended
contains an array of strings which is the remaining lines.
Upvotes: 1