Search code examples
tfsslack-apislack

Add Branch Name to Slack message TFS Service hook


I am using a service hook to notify my slack channel when ever a build finishes. What I would like to have is the branch name that is being built.

Is this possible?


Solution

  • As the Slack message format is <Build Format Number><Build Status> as the screenshot below:

    enter image description here

    So you can change the Build Format Number in build definition to $(Build.SourceBranchName)_$(date:yyyyMMdd)$(rev:.r). In this way, you can see the branch name in the Build Format Number:

    enter image description here