Skip to content

Commit

Permalink
extra/git-post-commit.sh: Add git post-commit Docker Hub trigger hook
Browse files Browse the repository at this point in the history
  • Loading branch information
scop committed Jun 22, 2018
1 parent ff65882 commit 03442fa
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions extra/git-post-commit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh -e

# Post-commit hook for triggering bash-completion Docker Hub test image
# builds at https://hub.docker.com/r/vskytta/bash-completion/
#
# To enable: ln -s ../../extra/git-post-commit.sh .git/hooks/post-commit
#
# The bash-completion.docker-hub-trigger-url config option must be set to
# the full Docker Hub build trigger URL to hit.

url=$(git config bash-completion.docker-hub-trigger-url)

test $(git symbolic-ref --short HEAD) = master

git diff-tree -r --name-only --no-commit-id HEAD | \
grep -qxF completions/Makefile.am

curl \
--silent --show-error \
--max-time 30 \
--header Content-Type:application/json \
--data '{"build":true}' \
$url >/dev/null

0 comments on commit 03442fa

Please sign in to comment.