From cccc3d6869d57eb289021bd9895b4778952f2d0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Sun, 6 Oct 2019 23:17:45 +0200 Subject: [PATCH] meh --- README.rst | 1 + providers.py | 19 +++++++++++++++++++ templates/tag.html | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index b33b739..4e8d520 100644 --- a/README.rst +++ b/README.rst @@ -1,3 +1,4 @@ +non ########## RepoHook ########## diff --git a/providers.py b/providers.py index 11e2b06..583ff5c 100644 --- a/providers.py +++ b/providers.py @@ -167,6 +167,7 @@ class GitLabHandlers(CommonGitWebProvider): 'issue_hook': 'issue', 'note_hook': 'comment', 'tag_push_hook': 'tag', + 'merge_request_hook': 'merge_request', }.get(event_type) def create_message(self, body, event_type, repo): @@ -183,6 +184,24 @@ class GitLabHandlers(CommonGitWebProvider): tag=tag ) + def msg_merge_request(self, body, repo): + def msg_pull_request(self, body, repo): + action = body['action'] + user = body['user']['name'] + if action == 'closed' and body['pull_request']['merged']: + user = body['pull_request']['merged_by']['login'] + action = 'merged' + if action == 'synchronize': + action = 'updated' + + return self.render_template( + template='merge_request', body=body, repo=repo, + action=action, user=user, + number=body['pull_request']['number'], + url=body['pull_request']['html_url'], + merged=body['pull_request']['merged'], + ) + def msg_push(self, body, repo): commit_nb = 0 if body['commits']: diff --git a/templates/tag.html b/templates/tag.html index 57be47f..88d0fcc 100644 --- a/templates/tag.html +++ b/templates/tag.html @@ -1 +1 @@ -\[{{repo_name}}] \[{{repo}}}] {{user}} created tag {{tag}}. +\[{{repo_name}}] \[{{repo}}] {{user}} created tag {{tag}}. -- GitLab