如何在 Travis 中以及在哪里添加电子邮件通知?

How add email notification in Travis and where?

我想为我和我的同事添加 Travis CI Build 的电子邮件通知。 无论结果是失败还是构建成功,我们都应该得到通知。 我的 git 帐户需要一些额外的设置吗? 在 Travis 中为电子邮件通知添加什么以及在哪里?我的意思是任何文件或者我可以添加到 .travis.yml 文件中?

谢谢

我已将电子邮件通知添加到存储库中的 .travis.yml 文件

notifications:  
  email:  
    recipients:  
    - xyz@abc.com  
    on_success: always  
    on_failure: always

您的回答是正确的,只是在您有多个电子邮件地址并且没有收到电子邮件通知时添加一个可能的陷阱:

Travis CI 仅向在 GitHub 上注册的电子邮件地址发送构建通知。 如果您注册了多个地址,您可以使用 git:

为特定存储库设置电子邮件地址

Note that this also changes the commit email address, not just the Travis CI notification settings.

git config user.email "mynewemail@example.com"

或者为所有 git 个存储库设置电子邮件:

git config --global user.email "mynewemail@example.com"

请注意,我们目前不遵守 GitHub 上的详细通知设置,因为此时它们不会通过 API 公开。

官方文档:https://docs.travis-ci.com/user/notifications/#Configuring-email-notifications