Run this script from Cron:
SERVER=irc.freenode.org
CHANNEL=mychannel
NICK=mynick
git pull
git log -4 --pretty=format:'%h - %an : %s (%cr)' > commits.txt
function announceCommits(){
(
echo NICK $NICK
echo USER $NICK 8 \* : Notifier
#echo "JOIN #$CHANNEL"
while read -r LINE ; do
#echo "PRIVMSG #$CHANNEL $LINE" >&2
echo "PRIVMSG #$CHANNEL :$LINE"
sleep 1
done < commits.txt
echo QUIT
) | nc -v $SERVER 6667
}
announceCommits
What's missing is detection of last announced commit.
That would go along the lines of keeping the last announed commit hash in a file, and only dumping the successors.
That should work with `git log --since`, but doesn't. I didn't want to spend more time fixing that as Jenkins does this for me (git poll build trigger).
Comments