Last active
April 28, 2017 04:33
-
-
Save Adirelle/a72138eabff4006f81d5 to your computer and use it in GitHub Desktop.
Post-commit hook to testing local PHPCI
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 | |
# | |
# Copy this script to .git/hooks/post-commit. | |
# Make it executable. | |
# Setup a project with "remote repository" (not local !) that points your PHPCI root. | |
# And finally, edit the two first lines according to your local installation. | |
PHPCI_URL=http://my.phpci.url | |
PROJECT_ID="PHPCI projet identifier" | |
BRANCH=$(git rev-parse --abbrev-ref HEAD) | |
IFS=^ INFO=($(git log -1 HEAD --format="%H^%ce^%s")) | |
echo -n "PHPCI webhook: " | |
curl \ | |
--data-urlencode branch="$BRANCH" \ | |
--data-urlencode commit="${INFO[0]}" \ | |
--data-urlencode committer="${INFO[1]}" \ | |
--data-urlencode message="${INFO[2]}" \ | |
"$PHPCI_URL/webhook/git/$PROJECT_ID" | |
echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment