Last active
October 26, 2017 09:34
-
-
Save q7r/c5e6b7ab8ca66aedaf1f00b29f52f3aa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Sends Slack notification ERROR_MSG to CHANNEL | |
# An env. variable CI_SLACK_WEBHOOK_URL needs to be set. | |
CHANNEL=$1 | |
ERROR_MSG=$2 | |
if [ -z "$CHANNEL" ] || [ -z "$ERROR_MSG" ] || [ -z "$CI_SLACK_WEBHOOK_URL" ]; then | |
echo "Missing argument(s) - Use: $0 channel message" | |
echo "and set CI_SLACK_WEBHOOK_URL environment variable." | |
else | |
curl -X POST --data-urlencode 'payload={"channel": "'"$CHANNEL"'", "username": "bb8", "text": "'"$ERROR_MSG"'", "icon_emoji": ":robot_face:"}' "$CI_SLACK_WEBHOOK_URL" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment