Torjus Håkestad
f0d2746b71
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
21 lines
578 B
Bash
Executable File
21 lines
578 B
Bash
Executable File
#!/bin/sh
|
|
|
|
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
|
|
|
|
OUTPUT_FILE=$(mktemp)
|
|
STATUS_CODE=$(curl -s --output "$OUTPUT_FILE" --write-out "%{http_code}" "${PLUGIN_GOTIFY_URL}/message?token=${PLUGIN_GOTIFY_TOKEN}" -F "title=${PLUGIN_TITLE}" -F "message=${PLUGIN_MESSAGE}" -F "priority=5")
|
|
if [ "$STATUS_CODE" -ne "200" ]; then
|
|
echo "Failed to send message:"
|
|
cat "$OUTPUT_FILE" | jq .
|
|
exit 1
|
|
fi
|
|
|
|
cat "$OUTPUT_FILE" | jq . |