feat(mm): more webhook events (#57)

This commit is contained in:
mQzLjP 2025-05-25 19:06:06 +08:00 committed by GitHub
parent 564b334a4a
commit 30e6d5aaeb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View File

@ -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

View File

@ -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']}",