From a307ae52050c57c473603eb49d74c2764b57171a Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Thu, 14 Mar 2024 00:07:37 +0100 Subject: [PATCH 1/2] shorten message when PR is opened --- eessi_bot_event_handler.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/eessi_bot_event_handler.py b/eessi_bot_event_handler.py index 74d4d6a1..01178447 100644 --- a/eessi_bot_event_handler.py +++ b/eessi_bot_event_handler.py @@ -336,15 +336,19 @@ def handle_pull_request_opened_event(self, event_info, pr): arch_map = get_architecture_targets(self.cfg) repo_cfg = get_repo_cfg(self.cfg) - comment = f"Instance `{app_name}` is configured to build:" - - for arch in arch_map.keys(): - # check if repo_target_map contains an entry for {arch} - if arch not in repo_cfg[REPO_TARGET_MAP]: - self.log(f"skipping arch {arch} because repo target map does not define repositories to build for") - continue - for repo_id in repo_cfg[REPO_TARGET_MAP][arch]: - comment += f"\n- arch `{'/'.join(arch.split('/')[1:])}` for repo `{repo_id}`" + comment = f"Instance `{app_name}` is configured to build for:" + architectures = ['/'.join(arch.split('/')[1:]) for arch in arch_map.keys()] + comment += "- architectures: " + if len(architectures) > 0: + comment += f"{', '.join([f"`{arch}`" for arch in architectures])}" + else: + comment += "none" + repositories = [repo_id for repo_id in repo_cfg[REPO_TARGET_MAP].keys()] + comment += "- repositories: " + if len(repositories) > 0: + comment += f"{', '.join([f"`{repo_id}`" for repo_id in repositories])}" + else: + comment += "none" self.log(f"PR opened: comment '{comment}'") From 31e793a202231027d7f5516a9d846228562cb1b2 Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Thu, 14 Mar 2024 00:51:27 +0100 Subject: [PATCH 2/2] polish output and show unique repo ids --- eessi_bot_event_handler.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/eessi_bot_event_handler.py b/eessi_bot_event_handler.py index 01178447..49f10238 100644 --- a/eessi_bot_event_handler.py +++ b/eessi_bot_event_handler.py @@ -338,15 +338,15 @@ def handle_pull_request_opened_event(self, event_info, pr): comment = f"Instance `{app_name}` is configured to build for:" architectures = ['/'.join(arch.split('/')[1:]) for arch in arch_map.keys()] - comment += "- architectures: " + comment += "\n- architectures: " if len(architectures) > 0: - comment += f"{', '.join([f"`{arch}`" for arch in architectures])}" + comment += f"{', '.join([f'`{arch}`' for arch in architectures])}" else: comment += "none" - repositories = [repo_id for repo_id in repo_cfg[REPO_TARGET_MAP].keys()] - comment += "- repositories: " + repositories = list(set([repo_id for repo_ids in repo_cfg[REPO_TARGET_MAP].values() for repo_id in repo_ids])) + comment += "\n- repositories: " if len(repositories) > 0: - comment += f"{', '.join([f"`{repo_id}`" for repo_id in repositories])}" + comment += f"{', '.join([f'`{repo_id}`' for repo_id in repositories])}" else: comment += "none"