Skip to content

Commit 03442fa

Browse files
committed
extra/git-post-commit.sh: Add git post-commit Docker Hub trigger hook
1 parent ff65882 commit 03442fa

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

extra/git-post-commit.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/sh -e
2+
3+
# Post-commit hook for triggering bash-completion Docker Hub test image
4+
# builds at https://hub.docker.com/r/vskytta/bash-completion/
5+
#
6+
# To enable: ln -s ../../extra/git-post-commit.sh .git/hooks/post-commit
7+
#
8+
# The bash-completion.docker-hub-trigger-url config option must be set to
9+
# the full Docker Hub build trigger URL to hit.
10+
11+
url=$(git config bash-completion.docker-hub-trigger-url)
12+
13+
test $(git symbolic-ref --short HEAD) = master
14+
15+
git diff-tree -r --name-only --no-commit-id HEAD | \
16+
grep -qxF completions/Makefile.am
17+
18+
curl \
19+
--silent --show-error \
20+
--max-time 30 \
21+
--header Content-Type:application/json \
22+
--data '{"build":true}' \
23+
$url >/dev/null

0 commit comments

Comments
 (0)