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.
This commit is contained in:
Mehdi Amini 2023-09-11 22:39:01 -07:00 committed by GitHub
parent 11c8b9c907
commit 38e9006896
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,6 +39,13 @@ If you have any further questions about this issue, don't hesitate to ask via a
"""
def _get_curent_team(team_name, teams) -> Optional[github.Team.Team]:
for team in teams:
if team_name == team.name.lower():
return team
return None
class IssueSubscriber:
@property
def team_name(self) -> str:
@ -51,18 +58,23 @@ class IssueSubscriber:
self._team_name = "issue-subscribers-{}".format(label_name).lower()
def run(self) -> bool:
for team in self.org.get_teams():
if self.team_name != team.name.lower():
continue
team = _get_curent_team(self.team_name, self.org.get_teams())
if not team:
print(f"couldn't find team named {self.team_name}")
return False
comment = ""
if team.slug == "issue-subscribers-good-first-issue":
comment = "{}\n".format(beginner_comment)
comment = ""
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>"
)
comment += "@llvm/{}".format(team.slug)
self.issue.create_comment(comment)
return True
return False
self.issue.create_comment(comment)
return True
def human_readable_size(size, decimal_places=2):
@ -86,7 +98,7 @@ class PRSubscriber:
def run(self) -> bool:
patch = None
team = self._get_curent_team()
team = _get_curent_team(self.team_name, self.org.get_teams())
if not team:
print(f"couldn't find team named {self.team_name}")
return False