From 30e6d5aaeb0897dd4486625166a427a3af35330c Mon Sep 17 00:00:00 2001 From: mQzLjP <91550006+mQzLjP@users.noreply.github.com> Date: Sun, 25 May 2025 19:06:06 +0800 Subject: [PATCH] feat(mm): more webhook events (#57) --- joint_teapot/app.py | 3 ++- joint_teapot/workers/mattermost.py | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/joint_teapot/app.py b/joint_teapot/app.py index 13f6437..a5e0160 100644 --- a/joint_teapot/app.py +++ b/joint_teapot/app.py @@ -237,7 +237,8 @@ def create_personal_channels_on_mm( "and configure them so that updates on gitea will be pushed to the mm channel", ) def create_webhooks_for_mm( - regex: str = Argument(""), gitea_suffix: bool = Option(True) + regex: str = Argument(""), + gitea_suffix: bool = Option(True, help="append gitea suffix to mm channel names"), ) -> None: repo_names = [ group_name diff --git a/joint_teapot/workers/mattermost.py b/joint_teapot/workers/mattermost.py index de64b2b..93cc47d 100644 --- a/joint_teapot/workers/mattermost.py +++ b/joint_teapot/workers/mattermost.py @@ -36,7 +36,7 @@ class Mattermost: except Exception: logger.error("Cannot login to Mattermost") return - if "admin" not in operator["roles"]: + if "admin" not in operator["roles"] and "system_user" not in operator["roles"]: logger.error("Please make sure you have enough permission") try: self.team = self.endpoint.teams.get_team_by_name(team_name) @@ -205,9 +205,16 @@ class Mattermost: events=[ "issues_only", "issue_comment", + "issue_assign", "pull_request_only", "pull_request_comment", "pull_request_review", + "pull_request_review_request", + "push", + "create", + "delete", + "release", + "wiki", ], config={ "url": f"https://{self.url}{self.url_suffix}/hooks/{mm_webhook['id']}",