support gitlab wiki events
This commit is contained in:
parent
df2240204d
commit
f43efbabcc
1 changed files with 16 additions and 0 deletions
|
@ -48,6 +48,12 @@ ISSUE_ACTIONS = {
|
||||||
"merge": "merged"
|
"merge": "merged"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WIKI_ACTIONS = {
|
||||||
|
"create": "created",
|
||||||
|
"update": "updated",
|
||||||
|
"delete": "deleted"
|
||||||
|
}
|
||||||
|
|
||||||
class GitLab(object):
|
class GitLab(object):
|
||||||
def is_private(self, data, headers):
|
def is_private(self, data, headers):
|
||||||
if "project" in data:
|
if "project" in data:
|
||||||
|
@ -112,6 +118,8 @@ class GitLab(object):
|
||||||
return self.note(full_name, data)
|
return self.note(full_name, data)
|
||||||
elif event == "tag_push":
|
elif event == "tag_push":
|
||||||
return self.tag_push(full_name, data)
|
return self.tag_push(full_name, data)
|
||||||
|
elif event == "wiki_page":
|
||||||
|
return self.wiki_page(data)
|
||||||
|
|
||||||
def _short_hash(self, hash):
|
def _short_hash(self, hash):
|
||||||
return hash[:7]
|
return hash[:7]
|
||||||
|
@ -207,3 +215,11 @@ class GitLab(object):
|
||||||
url = data["object_attributes"]["url"]
|
url = data["object_attributes"]["url"]
|
||||||
return [["[%s] %s commented on %s: %s" %
|
return [["[%s] %s commented on %s: %s" %
|
||||||
(type, commenter, number, title), url]]
|
(type, commenter, number, title), url]]
|
||||||
|
|
||||||
|
def wiki_page(self, data):
|
||||||
|
author = utils.irc.bold(data["user"]["username"])
|
||||||
|
action = data["object_attributes"]["action"]
|
||||||
|
action = WIKI_ACTIONS.get(action, action)
|
||||||
|
title = data["object_attributes"]["title"]
|
||||||
|
url = data["object_attributes"]["url"]
|
||||||
|
return [["%s %s a wiki page: %s" % (author, action, title), url]]
|
||||||
|
|
Loading…
Reference in a new issue