简体   繁体   English

github 操作:工作流失败通知

[英]github actions: notifications on workflow failure

We have a scheduled github action that fails sometimes.我们有一个计划的github 操作有时会失败。 How can I receive email notifications if it fails.如果失败,我如何接收 email 通知。 At the moment, only the creator of the workflow receives email notifications when it fails.目前,只有工作流的创建者在失败时会收到 email 通知。

我的设置

you can try this in your actions你可以在你的行动中尝试这个

- name: Send mail
  if: always()
  uses: dawidd6/action-send-mail@v2
  with:
    # mail server settings
    server_address: smtp.gmail.com
    server_port: 465
    # user credentials
    username: ${{ secrets.EMAIL_USERNAME }}
    password: ${{ secrets.EMAIL_PASSWORD }}
    # email subject
    subject: ${{ github.job }} job of ${{ github.repository }} has ${{ job.status }}
    # email body as text
    body: ${{ github.job }} job in worflow ${{ github.workflow }} of ${{ github.repository }} has ${{ job.status }}
    # comma-separated string, send email to
    to: abc@gmail.com,xyz@gmail.com
    # from email name
    from: XYZ

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM