[llvm] [Github] Escape `@` and html in the <details> block (PR #66118)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 12 10:53:30 PDT 2023
https://github.com/cor3ntin created https://github.com/llvm/llvm-project/pull/66118:
* This avoid pinging folks on all issue when they got pinged on bugzilla eaons ago
* Avoid formating bugs when there is html in the issue description
>From a3709722e3e8293bca0c8f9853bd9ffea9d89c1d Mon Sep 17 00:00:00 2001
From: Corentin Jabot <corentinjabot at gmail.com>
Date: Tue, 12 Sep 2023 19:48:47 +0200
Subject: [PATCH] [Github] Escape `@` and html in the <details> block
* This avoid pinging folks on all issue when they got pinged on
bugzilla eaons ago
* Avoid formating bugs when there is html in the issue description
---
llvm/utils/git/github-automation.py | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/llvm/utils/git/github-automation.py b/llvm/utils/git/github-automation.py
index c4c4848fbc5f8bc..66171cd7bd0144b 100755
--- a/llvm/utils/git/github-automation.py
+++ b/llvm/utils/git/github-automation.py
@@ -11,6 +11,7 @@
import argparse
from git import Repo # type: ignore
import github
+import html
import os
import re
import requests
@@ -45,6 +46,9 @@ def _get_curent_team(team_name, teams) -> Optional[github.Team.Team]:
return team
return None
+def escape_description(str):
+ # https://github.com/github/markup/issues/1168#issuecomment-494946168
+ return html.escape(str.replace("@", "@<!-- -->"), False)
class IssueSubscriber:
@property
@@ -66,12 +70,15 @@ def run(self) -> bool:
if team.slug == "issue-subscribers-good-first-issue":
comment = "{}\n".format(beginner_comment)
- comment = (
- f"@llvm/{team.slug}"
- + "\n\n<details>\n"
- + f"{self.issue.body}\n"
- + "</details>"
- )
+ body = escape_description(self.issue.body)
+
+ comment = ( f"""
+ at llvm/{team.slug}
+
+<details>
+{body}
+</details>
+""" )
self.issue.create_comment(comment)
return True
More information about the llvm-commits
mailing list