Skip to content

Instantly share code, notes, and snippets.

@c4urself
Created June 28, 2016 23:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save c4urself/5a67241321afd0a47a15bfb453038433 to your computer and use it in GitHub Desktop.
Save c4urself/5a67241321afd0a47a15bfb453038433 to your computer and use it in GitHub Desktop.
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