2023-03-27 20:28:12 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2023-03-27 22:11:09 +00:00
|
|
|
echo "Notifying job status: $1"
|
|
|
|
|
2023-03-27 21:25:16 +00:00
|
|
|
#GITHUB_RUN_NUMBER
|
|
|
|
# Job status: success/failure/cancelled
|
2023-03-27 20:28:12 +00:00
|
|
|
|
2023-03-27 22:11:09 +00:00
|
|
|
if [ "$1" = "success" ]; then
|
2023-03-27 22:13:38 +00:00
|
|
|
curl -s -u "${INPUT_USER}:${INPUT_PASSWORD}" \
|
2023-07-30 00:44:41 +00:00
|
|
|
-H "Title: Job ${GITHUB_JOB} Succeeded. ${GITHUB_REPOSITORY}/${GITHUB_REF}" \
|
2023-03-27 22:11:09 +00:00
|
|
|
-H "Tags: +1" \
|
2023-07-30 00:44:41 +00:00
|
|
|
-d "Job ${GITHUB_JOB} succeeded. See $GITHUB_SERVER_URL/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_NUMBER} for details" \
|
2023-03-27 22:11:09 +00:00
|
|
|
"${INPUT_HOST}${INPUT_TOPIC}"
|
|
|
|
elif [ "$1" = "failure" ]; then
|
2023-03-27 22:13:38 +00:00
|
|
|
curl -s -u "${INPUT_USER}:${INPUT_PASSWORD}" \
|
2023-07-30 00:44:41 +00:00
|
|
|
-H "Title: Job ${GITHUB_JOB} FAILED. ${GITHUB_REPOSITORY}/${GITHUB_REF}" \
|
2023-03-27 22:11:09 +00:00
|
|
|
-H "Priority: high" \
|
|
|
|
-H "Tags: warning" \
|
2023-07-30 00:44:41 +00:00
|
|
|
-d "Job ${GITHUB_JOB} failed. See $GITHUB_SERVER_URL/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_NUMBER} for details" \
|
2023-03-27 22:11:09 +00:00
|
|
|
"${INPUT_HOST}${INPUT_TOPIC}"
|
|
|
|
elif [ "$1" = "cancelled" ]; then
|
2023-03-27 22:13:38 +00:00
|
|
|
curl -s -u "${INPUT_USER}:${INPUT_PASSWORD}" \
|
2023-07-30 00:44:41 +00:00
|
|
|
-H "Title: Job ${GITHUB_JOB} cancelled. ${GITHUB_REPOSITORY}/${GITHUB_REF}" \
|
2023-03-27 22:11:09 +00:00
|
|
|
-H "Priority: low" \
|
|
|
|
-H "Tags: x" \
|
2023-07-30 00:44:41 +00:00
|
|
|
-d "Job ${GITHUB_JOB} cancelled. See $GITHUB_SERVER_URL/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_NUMBER} for details" \
|
2023-03-27 22:11:09 +00:00
|
|
|
"${INPUT_HOST}${INPUT_TOPIC}"
|
|
|
|
else
|
|
|
|
echo "Unknown job status $1"
|
|
|
|
exit 1
|
|
|
|
fi
|