Files
ntfy-notify/action.yml
T

52 lines
1.4 KiB
YAML
Raw Normal View History

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
ntfy_token:
description: 'ntfy auth token (bearer). Store in CI secret and pass via env:'
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:
- name: Send ntfy notification
shell: bash
env:
NTFY_URL: ${{ inputs.ntfy_url }}
NTFY_TOPIC: ${{ inputs.ntfy_topic }}
MESSAGE: ${{ inputs.message }}
run: |
if [ "${{ inputs.status }}" = "failure" ]; then
PRIORITY=5
TAGS="flying_saucer,warning,🚨,🛠️,action,failed"
else
PRIORITY=3
TAGS="rocket,white_check_mark,🎉,docker"
fi
AUTH=()
TOKEN="${NTFY_TOKEN:-${{ inputs.ntfy_token }}}"
if [ -n "$TOKEN" ]; then
AUTH=(-H "Authorization: Bearer ${TOKEN}")
fi
curl -sf \
-H "Title: CI Notification" \
-H "Priority: ${PRIORITY}" \
-H "Tags: ${TAGS}" \
"${AUTH[@]}" \
-d "${MESSAGE}" \
"${NTFY_URL}/${NTFY_TOPIC}"