added gitlab Tag Push events

This commit is contained in:
jesopo 2019-10-20 12:51:11 +01:00
parent ae549575e4
commit e0403aa3d2

View file

@ -27,13 +27,7 @@ EVENT_CATEGORIES = {
"issue-comment-minimal": [ "issue-comment-minimal": [
"issue_comment/created", "issue_comment/deleted" "issue_comment/created", "issue_comment/deleted"
], ],
"repo": [ "repo": ["tag_push"]
"create", # a repository, branch or tag has been created
"delete", # same as above but deleted
"release",
"fork",
"repository"
]
} }
COMMENT_ACTIONS = { COMMENT_ACTIONS = {
@ -90,10 +84,21 @@ class GitLab(object):
return self.issues(full_name, data) return self.issues(full_name, data)
elif event == "note": elif event == "note":
return self.note(full_name, data) return self.note(full_name, data)
elif event == "tag_push":
return self.tag_push(full_name, data)
def _short_hash(self, hash): def _short_hash(self, hash):
return hash[:8] return hash[:8]
def tag_push(self, full_name, data):
create = data["after"].strip("0")==""
tag = utils.irc.color(data["ref"].rsplit("/", 1)[-1],
colors.COLOR_BRANCH)
author = utils.irc.bold(data["user_username"])
action = "created" if create else "deleted"
return ["%s %s a tag: %s" % (author, action, tag)]
def push(self, full_name, data): def push(self, full_name, data):
outputs = [] outputs = []
branch = data["ref"].rpartition("/")[2] branch = data["ref"].rpartition("/")[2]