Skip to content

Instantly share code, notes, and snippets.

@artifactsauce
Last active August 29, 2015 13:57
Show Gist options
  • Save artifactsauce/9480292 to your computer and use it in GitHub Desktop.
Save artifactsauce/9480292 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -eu
API_TOKEN="<CHANGE_THIS>"
ROOM_ID="<CHANGE_THIS>"
REPOS=$(basename $(pwd))
REPOS=${REPOS%.*}
BRANCH=$(git rev-parse --symbolic --abbrev-ref $1)
MSG=$(git log -1 --pretty=format:"%h - %an : %s" $BRANCH)
BODY="(${REPOS}) [${BRANCH}] ${MSG}"
if [[ "$BRANCH" = 'master' ]]; then
BODY="[info][title]PUSHED INTO \`master\` BRANCH!!![/title]${BODY}[/info]"
fi
curl -X POST -H "X-ChatWorkToken: ${API_TOKEN}" -d "body=${BODY}" "https://api.chatwork.com/v1/rooms/${ROOM_ID}/messages" > /dev/null 2>&1
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment