summary refs log tree commit diff
path: root/.github/actions/notify_failure/action.yml
diff options
context:
space:
mode:
Diffstat (limited to '.github/actions/notify_failure/action.yml')
-rw-r--r--.github/actions/notify_failure/action.yml30
1 files changed, 30 insertions, 0 deletions
diff --git a/.github/actions/notify_failure/action.yml b/.github/actions/notify_failure/action.yml
new file mode 100644
index 0000000..3ca4019
--- /dev/null
+++ b/.github/actions/notify_failure/action.yml
@@ -0,0 +1,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 }}\" }"
\ No newline at end of file