Skip to content

Instantly share code, notes, and snippets.

@qixotic
qixotic / slack.sh
Last active April 20, 2016 06:02
Posts a message to slack with the change history since the last release of a service.
#!/bin/sh
# Posts a message to slack with the change history since the last release.
# Assumes you are tagging changes on production deploys with a handy prefix like:
# git tag release-`date \"+%Y%m%d_%H%M%S\"` && git push origin --tags
# Also you must have configured a slack https://api.slack.com/incoming-webhooks for your team.
RELEASE_TAG_PREFIX=release
LAST_CHANGE=$(git rev-list --tags="$RELEASE_TAG_PREFIX*" --no-walk --max-count=1 --abbrev-commit)
CHANGELOG=$(git log ${LAST_CHANGE}..HEAD --pretty="format:%<(10)%h %an: %s" -- .)
CHANGELOG=${CHANGELOG//\\/\\\\} # replace \ with \\