kasunkv / slack-notification

Slack Notification task with advanced slack message customization for Visual Studio Team Services
MIT License
20 stars 9 forks source link

How to write conditional for border color? #12

Open rushfrisby opened 6 years ago

rushfrisby commented 6 years ago

How do you write a conditional statement for setting the border color?

I want to set the border based on the status. This would be the C# equivalent...

$(Agent.JobStatus) == "Succeeded" ? "good" : ($(Agent.JobStatus) == "Failed" ? "danger" : "warning")

I'm not sure how to write this as the value to put into the Border Color property though.

gugavaro commented 5 years ago

you should create a powershell task that runs before your slack notification task. on that powershell task you can have your check and then create a vsts variable as a result of your check. then just use the variable on the border color field

rushfrisby commented 5 years ago

Thanks I'll give this a try

YotamHershk commented 3 years ago

@rushfrisby did you wrote something like that?