Files
infrastructure/.gitea/workflows/notify-ntfy.yml
2026-03-05 09:36:24 -07:00

52 lines
1.4 KiB
YAML

name: Notify NTFY
on:
workflow_dispatch:
inputs:
title:
required: true
type: string
message:
required: true
type: string
priority:
required: false
type: string
default: "default"
tags:
required: false
type: string
default: "warning"
action_url:
required: false
type: string
default: ""
jobs:
send-notification:
runs-on: [home-server]
env:
NTFY_CHANNEL: ${{ secrets.NTFY_CHANNEL }}
steps:
- name: Send ntfy notification
working-directory: /home/gitea-runner
run: |
set -e
if [ -n "${{ inputs.action_url }}" ]; then
cat <<EOF | curl -f -H "Title: ${{ inputs.title }}" \
-H "Priority: ${{ inputs.priority }}" \
-H "Tags: ${{ inputs.tags }}" \
-H "Actions: view, View Logs, ${{ inputs.action_url }}" \
--data-binary "@-" \
"https://ntfy.sh/${{ secrets.NTFY_CHANNEL }}"
${{ inputs.message }}
EOF
else
cat <<EOF | curl -f -H "Title: ${{ inputs.title }}" \
-H "Priority: ${{ inputs.priority }}" \
-H "Tags: ${{ inputs.tags }}" \
--data-binary "@-" \
"https://ntfy.sh/${{ secrets.NTFY_CHANNEL }}"
${{ inputs.message }}
EOF
fi