I'm using Bonobo (a windows git server), I'm new to it, and trying to on commit to origin it fire off a Python script which would be able to:
- find the user that did the last commit
- find the commit message
- send that information to Python
Once it has that data, it's going to post it to Slack. No problem there. I have Python that can take in command line arguments and post to Slack.
What I can't figure out is how to write my:
post-receive
Here is what I have:
#!C:/Program Files\ (x86)/SmartGit/git/usr/bin/sh.exe
message=`git log -1`
python D:/DEVELOPMENT/PHX/PYTHON/git_slack/git_slack.py -channel git_test -user python -message $message
So I can call python OK, but I can't get bash, well I think it's bash, I'm a Windows guy :( to populate message and then pass it to python. So '$message' just ends up being blank and my python fails.
If I write:
python D:/DEVELOPMENT/PHX/PYTHON/git_slack/git_slack.py -channel git_test -user python -message "here we go"
All the python works fine. I'm just missing something. If I type:
git log -1
From bash, I get a nice block of text that I would be happy to pass to Python and I could regex out the data to use it.
I must pass this information to Python and can't simply use bash to post to Slack as Python will do some work with our internal proxies and firewalls that I can't do in bash.
So my question is, what should my post-receive file look like to accomplice the 3 bullet points above. Thank you!