Skip to content

Instantly share code, notes, and snippets.

@AshCoolman
Last active September 8, 2015 09:52
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 AshCoolman/bef2781f73521dddf593 to your computer and use it in GitHub Desktop.
Save AshCoolman/bef2781f73521dddf593 to your computer and use it in GitHub Desktop.
Tell (Slack) webhook your last X commits
# Usage:
#
# ```
# $sh tell-slack-git-log.sh 2
# ```
#
# Creates slack message:
# ```
# Changes:
#
# 8d4b18d update (blah): Added thing
# b4e5753 update (blee): Added another
# ```
icon="mega"
channel="@coolman"
username="bot"
slackhook="https://hooks.slack.com/services/<ENTER_YOUR/SLACK_WEBHOOK_HERE>"
changes=$(git log --pretty=oneline --abbrev-commit -$1)
curl -X POST --data-urlencode "payload={\"channel\": \"$channel\", \"username\": \"$username\", \"text\": \"Changes:\n\n$changes\", \"icon_emoji\": \":$icon:\"}" $slackhook
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment