From 157b841f676540367533b8e77b0a5b6911d1f3b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Fri, 9 Aug 2024 07:27:43 +0200 Subject: [PATCH] Audit: Add links to logs in Snyk pull request --- github_app_geo_project/module/audit/__init__.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/github_app_geo_project/module/audit/__init__.py b/github_app_geo_project/module/audit/__init__.py index 32fc3d66eb8..4533c2cd7da 100644 --- a/github_app_geo_project/module/audit/__init__.py +++ b/github_app_geo_project/module/audit/__init__.py @@ -188,12 +188,8 @@ async def _process_snyk_dpkg( ) message.title = "Output URL" _LOGGER.debug(message) - if body is not None: - body.html += "\n" if output_url is not None: short_message.append(f"[Output]({output_url})") - if body is not None: - body.html += f"\nOutput" if context.module_event_data.type == "dpkg": body = module_utils.HtmlMessage("Update dpkg packages\n") @@ -203,8 +199,12 @@ async def _process_snyk_dpkg( context.module_config.get("dpkg", {}), local_config.get("dpkg", {}) ) - if body is not None: - body.html += f"\nLogs" + body_md = body.to_markdown() if body is not None else "" + del body + if body_md: + body_md.html += "\n" + body_md += f"[Logs]({logs_url})" + body_md += f"\n[Output]({output_url})" if output_url is not None else "" short_message.append(f"[Logs]({logs_url})") diff_proc = subprocess.run( # nosec # pylint: disable=subprocess-run-check @@ -234,7 +234,7 @@ async def _process_snyk_dpkg( branch, new_branch, f"Audit {key}", - "" if body is None else body.to_markdown(), + body_md, context.github_project, ) success &= new_success