plugin-gotify/entrypoint.sh
Torjus Håkestad f99aabb164
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Quote title
2022-01-10 15:07:56 +01:00

21 lines
555 B
Bash
Executable File

#!/bin/sh
# TODO: Verify that variables are set properly
if [ -z ${PLUGIN_GOTIFY_URL} ]; then
echo "PLUGIN_GOTIFY_URL is not set";
exit 1
fi
if [ -z ${PLUGIN_GOTIFY_TOKEN} ]; then
echo "PLUGIN_GOTIFY_TOKEN is not set";
exit 1
fi
res=$(curl -s "${PLUGIN_GOTIFY_URL}/message?token=${PLUGIN_GOTIFY_TOKEN}" -F "title=${PLUGIN_TITLE}" -F "message=${PLUGIN_MESSAGE}" -F "priority=5")
if [ "$?" -ne "0" ]; then
echo "Failed to send message"
exit "$?"
fi
echo "Sent message with title \"${PLUGIN_TITLE}\":"
echo "${PLUGIN_MESSAGE}"