Created
June 28, 2016 23:28
-
-
Save c4urself/5a67241321afd0a47a15bfb453038433 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
PULL=$( echo $BRANCH | awk -F/ '{ print $3 }' ) | |
html_url=https://api.github.com/repos/Tubular/$PROJECT/pulls/$PULL/commits | |
LINK=https://github.com/Tubular/$PROJECT/pull/$PULL | |
USER=$(curl $html_url?access_token=$GITHUB_TOKEN | python -c 'import json,sys;obj=json.load(sys.stdin);print obj[0]["commit"]["author"]["name"]') | |
curl -H "Content-Type: application/json" -d "{\"fallback\": \"Jenkins Pull-Request Publisher\", \"channel\": \"#deploys\", \"icon_emoji\": \":vertical_traffic_light:\", \"color\": \"#f2144b\", \"fields\": [{\"title\": \"$USER updated a pull-request in $PROJECT\", \"value\": \"<$LINK|$LINK>\", \"short\": false}]}" https://tubular.slack.com/services/hooks/incoming-webhook?token=$SLACK_TOKEN | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment