Created
June 27, 2013 22:42
-
-
Save mybuddymichael/5881064 to your computer and use it in GitHub Desktop.
Send a POST to a server with commit information.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Sends a POST request to a listening server with commit info. | |
set -e | |
user_name=$(git log -1 --pretty=%cn) | |
repo=$(basename "$(git rev-parse --show-toplevel)") | |
branch=$(git symbolic-ref HEAD 2> /dev/null | sed 's/refs\/heads\///g') | |
commit_message=$(git log -1 --pretty=%s) | |
sha=$(git log -1 --pretty=%h) | |
# Exit if rebasing. | |
if [ -z $branch ]; then | |
exit 0 | |
fi | |
(curl -sS \ | |
--data-urlencode user-name="$user_name" \ | |
--data-urlencode repo="$repo" \ | |
--data-urlencode branch="$branch" \ | |
--data-urlencode commit-message="$commit_message" \ | |
--data-urlencode sha="$sha" \ | |
http://localhost:8080 &) \ | |
> /dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment