diff options
Diffstat (limited to 'modules/github.py')
| -rw-r--r-- | modules/github.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/modules/github.py b/modules/github.py new file mode 100644 index 00000000..e0305d69 --- /dev/null +++ b/modules/github.py @@ -0,0 +1,27 @@ +import json +from src import ModuleManager, utils + +class Module(ModuleManager.BaseModule): + @utils.hook("api.post.github") + def github(self, event): + data = event["data"] + try: + data = json.loads(data) + except: + return + + if "commits" in data: + full_name = data["repository"]["full_name"] + + for commit in data["commits"]: + id = command["id"] + message = commit["message"] + author = "%s <%s>" % (commit["author"]["username"], + commit["author"]["email]) + modified_count = len(commit["modified"]) + added_count = len(commit["added"]) + removed_count = len(commit["removed"]) + + print("(%s) [%d/%d/%d mod/add/del] commit by %s: %s" % ( + full_name, modified_count, added_count, removed_count, + author, message)) |
