Skip to content

Email notifications on failure #350

@tbantle22

Description

@tbantle22

It looks like github actions only send failure notifications to the person who started the workflow or the person who created the worflow yaml file.

Looks like we can configure sending emails on failure like this:
https://www.ravsam.in/blog/send-email-notification-when-github-action-fails/

So that it will look something like:

- name: Send mail
  if: always()
  uses: dawidd6/action-send-mail@v2
  with:
    status: ${{ job.status }} # required
    notify_when: 'failure'
    # 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: [email protected],[email protected]
    # from email name
    from: John Doe

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions