2026-07-22 14:13:45 +02:00
|
|
|
name: 'ntfy Notify'
|
|
|
|
|
description: 'Send a ntfy notification for CI success or failure'
|
|
|
|
|
|
|
|
|
|
inputs:
|
|
|
|
|
ntfy_url:
|
|
|
|
|
description: 'ntfy server URL'
|
|
|
|
|
default: 'https://ntfy.zlymeda.dynu.net'
|
|
|
|
|
required: false
|
|
|
|
|
ntfy_topic:
|
|
|
|
|
description: 'ntfy topic'
|
|
|
|
|
required: true
|
2026-07-22 14:42:09 +02:00
|
|
|
ntfy_token:
|
|
|
|
|
description: 'ntfy auth token (bearer). Store in CI secret.'
|
|
|
|
|
default: ''
|
|
|
|
|
required: false
|
2026-07-22 14:13:45 +02:00
|
|
|
status:
|
|
|
|
|
description: 'Notification status: success or failure'
|
|
|
|
|
required: true
|
|
|
|
|
message:
|
|
|
|
|
description: 'Notification message body'
|
|
|
|
|
default: ''
|
|
|
|
|
|
|
|
|
|
runs:
|
|
|
|
|
using: composite
|
|
|
|
|
steps:
|
2026-07-22 14:32:01 +02:00
|
|
|
- name: Send ntfy notification
|
2026-07-22 14:30:17 +02:00
|
|
|
shell: bash
|
2026-07-22 14:32:01 +02:00
|
|
|
env:
|
|
|
|
|
NTFY_URL: ${{ inputs.ntfy_url }}
|
|
|
|
|
NTFY_TOPIC: ${{ inputs.ntfy_topic }}
|
2026-07-22 14:42:09 +02:00
|
|
|
NTFY_TOKEN: ${{ inputs.ntfy_token }}
|
2026-07-22 14:32:01 +02:00
|
|
|
MESSAGE: ${{ inputs.message }}
|
2026-07-22 14:30:17 +02:00
|
|
|
run: |
|
|
|
|
|
if [ "${{ inputs.status }}" = "failure" ]; then
|
2026-07-22 14:32:01 +02:00
|
|
|
PRIORITY=5
|
|
|
|
|
TAGS="flying_saucer,warning,🚨,🛠️,action,failed"
|
2026-07-22 14:30:17 +02:00
|
|
|
else
|
2026-07-22 14:32:01 +02:00
|
|
|
PRIORITY=3
|
|
|
|
|
TAGS="rocket,white_check_mark,🎉,docker"
|
2026-07-22 14:30:17 +02:00
|
|
|
fi
|
2026-07-22 14:42:09 +02:00
|
|
|
AUTH=()
|
|
|
|
|
if [ -n "${NTFY_TOKEN}" ]; then
|
|
|
|
|
AUTH=(-H "Authorization: Bearer ${NTFY_TOKEN}")
|
|
|
|
|
fi
|
2026-07-22 14:32:01 +02:00
|
|
|
curl -sf \
|
|
|
|
|
-H "Title: CI Notification" \
|
|
|
|
|
-H "Priority: ${PRIORITY}" \
|
|
|
|
|
-H "Tags: ${TAGS}" \
|
2026-07-22 14:42:09 +02:00
|
|
|
"${AUTH[@]}" \
|
2026-07-22 14:32:01 +02:00
|
|
|
-d "${MESSAGE}" \
|
|
|
|
|
"${NTFY_URL}/${NTFY_TOPIC}"
|