kore

Kore is a web application platform for writing scalable, concurrent web based processes in C or Python.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit 7632705c648dbefb272d757ec6b50a5cc8fb801c
parent 4ecd6d5603dd6803c206ed28f27616c41bf35ea7
Author: Joris Vink <joris@coders.se>
Date:   Thu,  5 Jan 2023 09:14:57 +0100

Version control the post-receive githook.

Diffstat:
misc/hooks/post-receive | 24++++++++++++++++++++++++
1 file changed, 24 insertions(+), 0 deletions(-)

diff --git a/misc/hooks/post-receive b/misc/hooks/post-receive @@ -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