From d91a4ada9ff7072151ee8be339e1b2385cf38ca9 Mon Sep 17 00:00:00 2001 From: jiaotianqin Date: Tue, 26 Sep 2023 08:09:29 +0800 Subject: [PATCH 1/3] provide MM settings & less events --- README.md | 2 +- joint_teapot/config.py | 6 +++++- joint_teapot/workers/mattermost.py | 6 ------ 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 5d9a841..19b4c68 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ close all issues and pull requests in gitea organization create channels for student groups according to group information on gitea. Optionally specify a prefix to ignore all repos whose names do not start with it. Optionally specify a suffix to add to all channels created. -Example: `python3 -m joint_teapot create_channels_for_groups --prefix p1 -suffix -private` will fetch all repos whose names start with `"p1"` and create channels on mm for these repos like "p1team1-private". Members of a repo will be added to the corresponding channel. +Example: `python3 -m joint_teapot create-channels-on-mm --prefix p1 --suffix -private --invite-teaching-team` will fetch all repos whose names start with `"p1"` and create channels on mm for these repos like "p1team1-private". Members of a repo will be added to the corresponding channel. And teaching team (maybe adjust `mattermost_teaching_team` list in `./joint_teapot/config.py`) will be invited to the channels. ### `create-issues` diff --git a/joint_teapot/config.py b/joint_teapot/config.py index 3c8eab9..56fef29 100644 --- a/joint_teapot/config.py +++ b/joint_teapot/config.py @@ -31,7 +31,11 @@ class Settings(BaseSettings): mattermost_access_token: str = "" mattermost_team: str = "" mattermost_teaching_team: List[str] = [ - "manuel", + "charlem", + "jiaotianqin", + "wyh2004", + "allen_wr", + "wwy125", ] # sid diff --git a/joint_teapot/workers/mattermost.py b/joint_teapot/workers/mattermost.py index 98ddada..b1beff2 100644 --- a/joint_teapot/workers/mattermost.py +++ b/joint_teapot/workers/mattermost.py @@ -115,15 +115,9 @@ def create_webhooks_for_repos(self, repos: List[str], gitea: Gitea) -> None: active=True, type="slack", events=[ - "create", - "delete", - "push", - "release", "issues_only", - "issue_assign", "issue_comment", "pull_request_only", - "pull_request_assign", "pull_request_comment", "pull_request_review", ], From 956ab17e79db2830bb2e59477a2df9249c842f36 Mon Sep 17 00:00:00 2001 From: jiaotianqin Date: Tue, 26 Sep 2023 08:30:18 +0800 Subject: [PATCH 2/3] fix: update .env.example with MM settings --- .env.example | 2 ++ joint_teapot/config.py | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.env.example b/.env.example index ffe3b31..035c78f 100644 --- a/.env.example +++ b/.env.example @@ -2,3 +2,5 @@ CANVAS_ACCESS_TOKEN=CiBD8fLtEhUOkcjdKhIj18Fx13WV1e3hwffewrfN3whAcS1IKPeJ41fBKq1E CANVAS_COURSE_ID=1445 GITEA_ACCESS_TOKEN=10cdf70f8fe1b7a5d3321e5a10d2d743e4818d4a GITEA_ORG_NAME=VG101 +MATTERMOST_TEAM=VG101 +MATTERMOST_ACCESS_TOKEN=qjnpxytsgpdnxfbpyhrinzdapl diff --git a/joint_teapot/config.py b/joint_teapot/config.py index 56fef29..9d4a15c 100644 --- a/joint_teapot/config.py +++ b/joint_teapot/config.py @@ -32,10 +32,6 @@ class Settings(BaseSettings): mattermost_team: str = "" mattermost_teaching_team: List[str] = [ "charlem", - "jiaotianqin", - "wyh2004", - "allen_wr", - "wwy125", ] # sid From 607fd1814cd4f7b4694d5bf0be6440c99d41e838 Mon Sep 17 00:00:00 2001 From: CHHC-L <136193358+serkini@users.noreply.github.com> Date: Wed, 27 Sep 2023 11:30:23 +0800 Subject: [PATCH 3/3] set mm teaching team in .env --- .env.example | 1 + README.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.env.example b/.env.example index 035c78f..ea33025 100644 --- a/.env.example +++ b/.env.example @@ -4,3 +4,4 @@ GITEA_ACCESS_TOKEN=10cdf70f8fe1b7a5d3321e5a10d2d743e4818d4a GITEA_ORG_NAME=VG101 MATTERMOST_TEAM=VG101 MATTERMOST_ACCESS_TOKEN=qjnpxytsgpdnxfbpyhrinzdapl +MATTERMOST_TEACHING_TEAM=["A", "B", "C"] diff --git a/README.md b/README.md index 19b4c68..a363501 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ close all issues and pull requests in gitea organization create channels for student groups according to group information on gitea. Optionally specify a prefix to ignore all repos whose names do not start with it. Optionally specify a suffix to add to all channels created. -Example: `python3 -m joint_teapot create-channels-on-mm --prefix p1 --suffix -private --invite-teaching-team` will fetch all repos whose names start with `"p1"` and create channels on mm for these repos like "p1team1-private". Members of a repo will be added to the corresponding channel. And teaching team (maybe adjust `mattermost_teaching_team` list in `./joint_teapot/config.py`) will be invited to the channels. +Example: `python3 -m joint_teapot create-channels-on-mm --prefix p1 --suffix -private --invite-teaching-team` will fetch all repos whose names start with `"p1"` and create channels on mm for these repos like "p1team1-private". Members of a repo will be added to the corresponding channel. And teaching team (adjust in `.env`) will be invited to the channels. ### `create-issues`