Created
March 27, 2018 08:51
-
-
Save leesio/567b07bc813365ddca08911319507acf to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
# This hook is called with the following parameters: | |
# | |
# $1 -- Name of the remote to which the push is being done | |
# $2 -- URL to which the push is being done | |
URL="$2" | |
if [[ ! $URL = *"git@github.com"* ]]; then | |
exit 0 | |
fi | |
REPO_PATH="$(echo $URL | sed -E 's/^.*:(.*).git.*/\1/')" | |
ORG="$(echo $REPO_PATH | cut -f1 -d '/')" | |
REPO="$(echo $REPO_PATH | cut -f2 -d '/')" | |
BRANCH="$(git rev-parse --abbrev-ref HEAD)" | |
echo "Pull request url: https://github.com/$ORG/$REPO/compare/$BRANCH?expand=1" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment