[llvm] Include the issue description in the subscription comment so that email notification is self-contained (PR #65839)
Mehdi Amini via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 8 23:07:15 PDT 2023
https://github.com/joker-eph created https://github.com/llvm/llvm-project/pull/65839:
This makes it so that we don't need to open the issue to have the description in our inbox on subscription.
>From c62af006c43212f469661dc4e2d9d1677cab77e0 Mon Sep 17 00:00:00 2001
From: Mehdi Amini <joker.eph at gmail.com>
Date: Fri, 8 Sep 2023 23:05:51 -0700
Subject: [PATCH] Include the issue description in the subscription comment so
that email notification is self-contained
This makes it so that we don't need to open the issue to have the description
in our inbox on subscription.
---
llvm/utils/git/github-automation.py | 34 +++++++++++++++++++----------
1 file changed, 23 insertions(+), 11 deletions(-)
diff --git a/llvm/utils/git/github-automation.py b/llvm/utils/git/github-automation.py
index 7df20ea8457155..c4c4848fbc5f8b 100755
--- a/llvm/utils/git/github-automation.py
+++ b/llvm/utils/git/github-automation.py
@@ -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:
@@ -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):
@@ -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
More information about the llvm-commits
mailing list