From 1498b5712f223da3eada37243007242cd45de552 Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 31 Jul 2023 21:41:53 +0700 Subject: [PATCH] trigger website rebuild on build hook --- tubearchivist/web/src/webhook_base.py | 8 ++++++++ tubearchivist/web/src/webhook_github.py | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/tubearchivist/web/src/webhook_base.py b/tubearchivist/web/src/webhook_base.py index 7dcbf25..4722b32 100644 --- a/tubearchivist/web/src/webhook_base.py +++ b/tubearchivist/web/src/webhook_base.py @@ -45,6 +45,14 @@ class WebhookBase: "rebuild": [ ["docker", "compose", "-f", "../docker/docker-compose.yml", "up", "-d", "--build", "docs"] ] + }, + "website": { + "gh_user": "tubearchivist", + "gh_repo": "docs", + "unstable_keyword": "#build", + "rebuild": [ + ["docker", "compose", "-f", "../docker/docker-compose.yml", "up", "-d", "--build", "tubearchivist"] + ] } } ROADMAP_HOOK_URL = environ.get("ROADMAP_HOOK_URL") diff --git a/tubearchivist/web/src/webhook_github.py b/tubearchivist/web/src/webhook_github.py index df1f2fd..9b7bb94 100644 --- a/tubearchivist/web/src/webhook_github.py +++ b/tubearchivist/web/src/webhook_github.py @@ -79,6 +79,14 @@ class GithubHook(WebhookBase): TaskHandler(self.repo_conf).create_task("rebuild") return + if self.repo == "website": + to_rebuild = self.check_commit_message() + if to_rebuild: + TaskHandler(self.repo_conf).create_task("rebuild") + else: + print("build keyword not found in commit message") + return + self._check_readme() build_message = self.check_commit_message()