#!/bin/sh # WARNING: Putting your git repo in your web root can be dangerous. SLACK_WEBHOOK_URL=$(git config --get hooks.slack.deploy-webhook-url) SLACK_USERNAME="Git Deploy Bot (Develop)" REPO_PATH="$(dirname ${BASH_SOURCE[0]})/.." GIT_ORIG_HEAD=$(git rev-parse ORIG_HEAD | awk '{print $1}') GIT_HEAD=$(git rev-parse HEAD | awk '{print $1}') GIT_ORIG_HEAD_SHORT=${GIT_ORIG_HEAD:0:9} GIT_HEAD_SHORT=${GIT_HEAD:0:9} # Create message GIT_MESSAGE="Deploy ($GIT_ORIG_HEAD_SHORT..$GIT_HEAD_SHORT):\n" GIT_MESSAGE+=\`\`\`"$(git log --pretty=format:'%h %cr %cn %Cgreen%s%Creset' ORIG_HEAD..HEAD)"\`\`\` # Send to Slack curl -s -X POST --data "payload={ \"username\": \"${SLACK_USERNAME}\", \"text\": \"${GIT_MESSAGE}\"}" ${SLACK_WEBHOOK_URL} > /dev/null