88
99_NULL = ' '
1010_FILE_OUT = 'release_issue_status.csv'
11+ _PYTHON_SDK_ADMINISTRATORS = {'msyyc' , 'RAY-316' , 'BigCat20196' }
1112
1213
1314def my_print (cmd ):
@@ -32,6 +33,9 @@ class IssueStatus:
3233 comment_num = 0
3334 language = _NULL
3435 author_latest_comment = _NULL
36+ whether_author_comment = True
37+ issue_object = _NULL
38+ labels = _NULL
3539
3640 def output (self ):
3741 return '{},{},{},{},{},{},{},{},{},{}\n ' .format (self .language , self .link , self .author ,
@@ -79,6 +83,13 @@ def _extract_author_latest_comment(comments):
7983 return _NULL if not q else q [- 1 ][1 ]
8084
8185
86+ def _whether_author_comment (comments ):
87+ q = set (comment .user .login for comment in comments )
88+ diff = q .difference (_PYTHON_SDK_ADMINISTRATORS )
89+
90+ return len (diff ) > 0
91+
92+
8293def main ():
8394 # get latest issue status
8495 g = Github (os .getenv ('TOKEN' )) # please fill user_token
@@ -103,6 +114,9 @@ def main():
103114 issue .comment_num = item .comments
104115 issue .language = _extract_language (item .labels )
105116 issue .author_latest_comment = _extract_author_latest_comment (item .get_comments ())
117+ issue .whether_author_comment = _whether_author_comment (item .get_comments ())
118+ issue .issue_object = item
119+ issue .labels = [label .name for label in item .labels ]
106120
107121 issue_status .append (issue )
108122 key = (issue .language , issue .package )
@@ -114,7 +128,8 @@ def main():
114128 # rule2: if latest comment is from author, need response asap
115129 # rule3: if comment num is 0, it is new issue, better to deal with it asap
116130 # rule4: if delay from latest update is over 7 days, better to deal with it soon.
117- # rule5: if delay from created date is over 30 days, better to close.
131+ # rule5: if delay from created date is over 30 days and owner never reply, close it.
132+ # rule6: if delay from created date is over 15 days and owner never reply, remind owner to handle it.
118133 for item in issue_status :
119134 if item .status == 'release' :
120135 item .bot_advice = 'better to release asap.'
@@ -124,9 +139,19 @@ def main():
124139 item .bot_advice = 'new issue and better to confirm quickly.'
125140 elif item .delay_from_latest_update >= 7 :
126141 item .bot_advice = 'delay for a long time and better to handle now.'
127- elif item .delay_from_create_date >= 30 :
128- item .bot_advice = 'delay for a month and better to close.'
129-
142+
143+ if item .delay_from_create_date >= 30 and item .language == 'Python' and not item .whether_author_comment and '30days attention' not in item .labels :
144+ item .labels .append ('30days attention' )
145+ item .issue_object .set_labels (* item .labels )
146+ item .issue_object .create_comment (f'hi @{ item .author } , the issue is closed since there is no reply for a long time. Please reopen it if necessary or create new one.' )
147+ issue .issue_object .edit (state = 'close' )
148+ elif item .delay_from_create_date >= 15 and item .language == 'Python' and not item .whether_author_comment and '15days attention' not in item .labels :
149+ item .issue_object .create_comment (f'hi @{ item .author } , this release-request has been delayed more than 15 days,'
150+ ' please deal with it ASAP. We will close the issue if there is still no response after 15 days!' )
151+ item .labels .append ('15days attention' )
152+ item .issue_object .set_labels (* item .labels )
153+
154+
130155 # judge whether there is duplicated issue for same package
131156 if item .package != _NULL and duplicated_issue .get ((item .language , item .package )) > 1 :
132157 item .bot_advice = f'Warning:There is duplicated issue for { item .package } . ' + item .bot_advice
0 commit comments