user9920500
user9920500

Reputation: 705

How to restrict build failure emails to only a specific branch in travis CI?

I have email and slack notifications configured for travis build failures. Currently It sends notifications for build failure of every branch. Since every developer does creates lot of branches, the mails come in a large number which sound like spam. I would want to restrict the mails only for failures of develop branch.

My configuration in .travis.yml is something like this.

notifications:
   email:
    recipients:
     - xyz@abc.com
    branches:
      only: develop
    on_success: change
    on_failure: always

Is this branch specific alerts are really supported, if yes how do you do it ?

Upvotes: 3

Views: 574

Answers (1)

Madhu Bhat
Madhu Bhat

Reputation: 15253

For your specific query about if branch specific notification is supported by Travis currently, the answer is NO. Below is from the Travis documentation:

There is currently no way of limiting the notification to a specific branch, but the payload will contain all relevant data to do so at the receiving end

So currently the branch specific notification is not supported by Travis, but would need to be implemented separately by consuming the webhook payload from Travis.

Update: (Courtesy @LucasCimon) There is an open GitHub issue to track this feature request.

Upvotes: 5

Related Questions