39
39
"""
40
40
41
41
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
+
42
49
class IssueSubscriber :
43
50
@property
44
51
def team_name (self ) -> str :
@@ -51,18 +58,23 @@ def __init__(self, token: str, repo: str, issue_number: int, label_name: str):
51
58
self ._team_name = "issue-subscribers-{}" .format (label_name ).lower ()
52
59
53
60
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 )
57
68
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
+ )
61
75
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
66
78
67
79
68
80
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):
86
98
87
99
def run (self ) -> bool :
88
100
patch = None
89
- team = self ._get_curent_team ( )
101
+ team = _get_curent_team ( self .team_name , self . org . get_teams () )
90
102
if not team :
91
103
print (f"couldn't find team named { self .team_name } " )
92
104
return False
0 commit comments