Last active
November 30, 2016 05:21
-
-
Save Funi1234/c4f593c53c3b17cef323e6d2d6d8fed5 to your computer and use it in GitHub Desktop.
xcodeSlack.sh
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/sh | |
# | |
# Created by Funi1234 on 30/06/2016. | |
# | |
if [ -z "$1" ]; then | |
echo "Slack Webhook URL Required." | |
echo "Exiting" | |
exit | |
fi | |
env | |
echo "-----------------------------------" | |
if [ $XCS_ERROR_CHANGE -ne 0 ] || [ $XCS_TEST_FAILURE_CHANGE -ne 0 ] || [ $XCS_ANALYZER_WARNING_CHANGE -ne 0 ] || [ $XCS_WARNING_CHANGE -ne 0 ]; then | |
COLOUR='good' | |
if [ $XCS_INTEGRATION_RESULT == 'warnings' ] || [ $XCS_INTEGRATION_RESULT == 'analyzer-warnings' ]; then | |
COLOUR='warning' | |
elif [ $XCS_INTEGRATION_RESULT != 'succeeded' ]; then | |
COLOUR='danger' | |
fi | |
PAYLOAD=$(cat << EOF | |
{ | |
"attachments": [ | |
{ | |
"fallback": "XcodeBot '$XCS_BOT_NAME' has completed a build.", | |
"color": "$COLOUR", | |
"title": "Xcode '$XCS_BOT_NAME' test #$XCS_INTEGRATION_NUMBER completed with the result: $XCS_INTEGRATION_RESULT.", | |
"text": "$XCS_TESTS_COUNT tests with $XCS_TEST_FAILURE_COUNT failures.", | |
"fields": [ | |
{ | |
"value": "$XCS_ERROR_COUNT errors, and $XCS_WARNING_COUNT warnings.", | |
"short": false | |
} | |
] | |
} | |
], | |
"channel": "#ios", | |
"icon_emoji": ":robot_face:", | |
"username": "XcodeBot" | |
} | |
EOF) | |
curl -X POST --data-urlencode "payload=${PAYLOAD}" $1 | |
fi | |
echo "Done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment