You can use this template to setup a workflow that listens in to incoming messages and whenever it receives a message from github notifying a github action failed post the message's subject to a discord channel.
version: "0.1"
addresses:
[email protected]:
keys:
- name: owner
read: true
write: true
accessories:
- name: [email protected]
type: mailscript-email
address: [email protected]
key: owner
workflows:
- name: Build failed to discord#channel
trigger:
accessory: [email protected]
config:
criterias:
- from: [email protected]
subjectContains: run failed
actions:
- config:
type: webhook
body: |
{
"content": "Build failed: {{msg.subject}}"
}
url: "https://discord.webhook"
opts:
headers:
Content-Type: application/json
method: POST
Expects body.json
file containing { content: "Build failed: {{msg.subject}}" }
mailscript workflows:add \
--name "Build failed to discord#channel" \
--trigger [email protected] \
--from [email protected] \
--subjectcontains "run failed" \
--action webhook \
--webhook "https://discord.webhook" \
--body body.json
Make sure you have edit access to a given channel. Navigate to Edit channel > Integrations > Webhhoks
and create a new webhook (or pick an existing one). Copy the webhook url and added it the body.json
file.