Skip to content

featuredotapp/template-run-failed-to-discord

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Mailscript templates: GitHub action fails, post message to discord #channel

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.

Workflow

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

Manual setup

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

Discord setup

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published