summary refs log tree commit diff
path: root/.github/actions/notify_failure/action.yml
blob: 3ca4019dc612a7bc4a06aebf1fc8e8b804407cc0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
name: Notify failure
description: Sends a notification that compiling a build has failed
inputs:
  BOT_USERNAME:
    description: 'Username to use for the discord bot message'
    default: 'CC BuildBot'
    required: false
    type: string
  BOT_AVATAR:
    description: 'URL to use for the avatar of the discord bot message'
    default: 'https://static.classicube.net/img/cc-cube-small.png'
    required: false
    type: string
  NOTIFY_MESSAGE:
    description: 'Notification message to send'
    required: true
    type: string
  WEBHOOK_URL:
    description: 'Discord webhook URL'
    required: true
    type: string

runs:
  using: "composite"
  steps:
    - name: Notify failure
      shell: sh
      if: ${{ inputs.WEBHOOK_URL != '' }}
      run: |
        curl ${{ inputs.WEBHOOK_URL }} -H "Accept: application/json" -H "Content-Type:application/json" -X POST --data "{\"username\": \"${{ inputs.BOT_USERNAME }}\", \"avatar_url\": \"${{ inputs.BOT_AVATAR }}\", \"content\": \"${{ inputs.NOTIFY_MESSAGE }}\" }"