Skip to content

Include the issue description in the subscription comment so that email notification is self-contained #65839

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 23 additions & 11 deletions llvm/utils/git/github-automation.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@
"""


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:
Expand All @@ -51,18 +58,23 @@ def __init__(self, token: str, repo: str, issue_number: int, label_name: str):
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):
Expand All @@ -86,7 +98,7 @@ def __init__(self, token: str, repo: str, pr_number: int, label_name: str):

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
Expand Down