From efad4a83bb6c92568aca8fa3d3cf5e4b291be986 Mon Sep 17 00:00:00 2001 From: Claas Augner Date: Fri, 10 Jan 2025 12:41:53 +0100 Subject: [PATCH 1/3] fix(deployer): avoid GitHub mentions `redirect.github.com` is also used by Dependabot for the same purpose. --- deployer/src/deployer/analyze_pr.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/deployer/src/deployer/analyze_pr.py b/deployer/src/deployer/analyze_pr.py index 3e965d10d024..a425653cd0cd 100644 --- a/deployer/src/deployer/analyze_pr.py +++ b/deployer/src/deployer/analyze_pr.py @@ -171,6 +171,8 @@ def post_about_dangerous_content( external_urls_list = [] for url in sorted(external_urls): count = external_urls[url] + # Avoid GitHub mentions. + url = url.replace('https://github.com/', 'https://redirect.github.com/') line = ( f" - {'🚨 ' if url.startswith('http://') else ''}" f"<{url}> ({count} time{'' if count==1 else 's'})" From aa3990ba938853bcda8fe4590b6e1125f5098463 Mon Sep 17 00:00:00 2001 From: Claas Augner Date: Fri, 10 Jan 2025 12:52:50 +0100 Subject: [PATCH 2/3] fix(deployer): keep original url as link text --- deployer/src/deployer/analyze_pr.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/deployer/src/deployer/analyze_pr.py b/deployer/src/deployer/analyze_pr.py index a425653cd0cd..ef760ed66c26 100644 --- a/deployer/src/deployer/analyze_pr.py +++ b/deployer/src/deployer/analyze_pr.py @@ -172,10 +172,12 @@ def post_about_dangerous_content( for url in sorted(external_urls): count = external_urls[url] # Avoid GitHub mentions. + original_url = url url = url.replace('https://github.com/', 'https://redirect.github.com/') + link = f"<{url}>" if url == original_url else f"[{original_url}](<{url}>)" line = ( f" - {'🚨 ' if url.startswith('http://') else ''}" - f"<{url}> ({count} time{'' if count==1 else 's'})" + f"{link} ({count} time{'' if count == 1 else 's'})" ) if diff_lines: # If this was available and it _did_ fine a URL, then From acc99ed8ec6b15fa7ef7d72a428903b3d79089c8 Mon Sep 17 00:00:00 2001 From: Claas Augner Date: Fri, 10 Jan 2025 15:52:42 +0100 Subject: [PATCH 3/3] style(black): run `black deployer/src` --- deployer/src/deployer/analyze_pr.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/deployer/src/deployer/analyze_pr.py b/deployer/src/deployer/analyze_pr.py index ef760ed66c26..69491289e11e 100644 --- a/deployer/src/deployer/analyze_pr.py +++ b/deployer/src/deployer/analyze_pr.py @@ -173,8 +173,10 @@ def post_about_dangerous_content( count = external_urls[url] # Avoid GitHub mentions. original_url = url - url = url.replace('https://github.com/', 'https://redirect.github.com/') - link = f"<{url}>" if url == original_url else f"[{original_url}](<{url}>)" + url = url.replace("https://github.com/", "https://redirect.github.com/") + link = ( + f"<{url}>" if url == original_url else f"[{original_url}](<{url}>)" + ) line = ( f" - {'🚨 ' if url.startswith('http://') else ''}" f"{link} ({count} time{'' if count == 1 else 's'})"