Skip to content

Commit 38e9006

Browse files
authored
Include the issue description in the subscription comment so that email notification is self-contained (#65839)
This makes it so that we don't need to open the issue to have the description in our inbox on subscription.
1 parent 11c8b9c commit 38e9006

File tree

1 file changed

+23
-11
lines changed

1 file changed

+23
-11
lines changed

llvm/utils/git/github-automation.py

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@
3939
"""
4040

4141

42+
def _get_curent_team(team_name, teams) -> Optional[github.Team.Team]:
43+
for team in teams:
44+
if team_name == team.name.lower():
45+
return team
46+
return None
47+
48+
4249
class IssueSubscriber:
4350
@property
4451
def team_name(self) -> str:
@@ -51,18 +58,23 @@ def __init__(self, token: str, repo: str, issue_number: int, label_name: str):
5158
self._team_name = "issue-subscribers-{}".format(label_name).lower()
5259

5360
def run(self) -> bool:
54-
for team in self.org.get_teams():
55-
if self.team_name != team.name.lower():
56-
continue
61+
team = _get_curent_team(self.team_name, self.org.get_teams())
62+
if not team:
63+
print(f"couldn't find team named {self.team_name}")
64+
return False
65+
comment = ""
66+
if team.slug == "issue-subscribers-good-first-issue":
67+
comment = "{}\n".format(beginner_comment)
5768

58-
comment = ""
59-
if team.slug == "issue-subscribers-good-first-issue":
60-
comment = "{}\n".format(beginner_comment)
69+
comment = (
70+
f"@llvm/{team.slug}"
71+
+ "\n\n<details>\n"
72+
+ f"{self.issue.body}\n"
73+
+ "</details>"
74+
)
6175

62-
comment += "@llvm/{}".format(team.slug)
63-
self.issue.create_comment(comment)
64-
return True
65-
return False
76+
self.issue.create_comment(comment)
77+
return True
6678

6779

6880
def human_readable_size(size, decimal_places=2):
@@ -86,7 +98,7 @@ def __init__(self, token: str, repo: str, pr_number: int, label_name: str):
8698

8799
def run(self) -> bool:
88100
patch = None
89-
team = self._get_curent_team()
101+
team = _get_curent_team(self.team_name, self.org.get_teams())
90102
if not team:
91103
print(f"couldn't find team named {self.team_name}")
92104
return False

0 commit comments

Comments
 (0)