mirror of
https://github.com/jorisvink/kore
synced 2025-03-09 04:29:02 -04:00
Version control the post-receive githook.
This commit is contained in:
parent
4ecd6d5603
commit
7632705c64
24
misc/hooks/post-receive
Normal file
24
misc/hooks/post-receive
Normal file
@ -0,0 +1,24 @@
|
||||
#!/usr/local/bin/bash
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
URL=discord-hook
|
||||
|
||||
while read oldrev newrev ref; do
|
||||
if [[ $ref =~ .*/master$ ]]; then
|
||||
logmsg=""
|
||||
commits=$(git rev-list ${oldrev}..${newrev})
|
||||
for commit in $commits; do
|
||||
log=$(git log -1 --pretty=format:'[%h](https://github.com/jorisvink/kore/commit/%H) %cn: %s' $commit)
|
||||
logmsg="$logmsg $log\\n"
|
||||
done
|
||||
|
||||
curl -i \
|
||||
-H "Accept: application/json" \
|
||||
-H "Content-type: application/json" \
|
||||
-X POST \
|
||||
-d "{\"content\": \"${logmsg}\"}" \
|
||||
$URL
|
||||
fi
|
||||
done
|
Loading…
x
Reference in New Issue
Block a user