-
-
Save kiy0taka/571383 to your computer and use it in GitHub Desktop.
Using Groovy to Git post-commit hook: IRC Bot to print commit Message
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grab('pircbot:pircbot:1.4.2') | |
import org.jibble.pircbot.*; | |
def (host, port, channel) = ['<Server>', <Port>, '<Channel>'] | |
def bot = [:] as PircBot | |
bot.name = 'groovy_bot' | |
bot.encoding = 'ISO-2022-JP' | |
bot.connect host, port | |
bot.joinChannel channel | |
bot.sendRawLine(args*.split('\n').flatten().collect{"PRIVMSG $channel :$it"}.join('\n')) | |
bot.disconnect() | |
System.exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export LANG=ja_JP.UTF-8 | |
export JAVA_HOME=/usr/lib/jvm/jre-1.6.0-openjdk/ | |
export GROOVY_HOME=/usr/local/groovy | |
export PATH=$JAVA_HOME/bin:$GROOVY_HOME/bin:$PATH | |
LOG=`git log -1` | |
groovy /path/to/git-repo/hooks/commit-irc.groovy "$LOG" >> /tmp/post-commit.log 2>&1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment