@@ -212,25 +212,29 @@ def get_activity(
212212 since_dt_str = f"{ since_dt :%Y-%m-%dT%H:%M:%SZ} "
213213 until_dt_str = f"{ until_dt :%Y-%m-%dT%H:%M:%SZ} "
214214
215+ # GitHub App requests using user access tokens return no nodes for mixed
216+ # issue/PR searches, so we search for each kind separately.
217+ kinds = ["issue" , "pr" ]
215218 if kind :
216- allowed_kinds = ["issue" , "pr" ]
217- if kind not in allowed_kinds :
218- raise ValueError (f"Kind must be one of { allowed_kinds } , got { kind } " )
219- search_query += f" type:{ kind } "
219+ if kind not in kinds :
220+ raise ValueError (f"Kind must be one of { kinds } , got { kind } " )
221+ kinds = [kind ]
220222
221223 # Query for both opened and closed issues/PRs in this window
222224 print (f"Running search query:\n { search_query } \n \n " , file = sys .stderr )
223225 query_data = []
224226 all_bot_users = set ()
225227 for activity_type in ["created" , "closed" ]:
226- ii_search_query = (
227- search_query + f" { activity_type } :{ since_dt_str } ..{ until_dt_str } "
228- )
229- qu = GitHubGraphQlQuery (ii_search_query , auth = auth )
230- qu .request ()
231- query_data .append (qu .data )
232- # Collect bot users from each query
233- all_bot_users .update (qu .data .attrs .get ("bot_users" , set ()))
228+ for ii_kind in kinds :
229+ ii_search_query = (
230+ search_query
231+ + f" type:{ ii_kind } { activity_type } :{ since_dt_str } ..{ until_dt_str } "
232+ )
233+ qu = GitHubGraphQlQuery (ii_search_query , auth = auth )
234+ qu .request ()
235+ query_data .append (qu .data )
236+ # Collect bot users from each query
237+ all_bot_users .update (qu .data .attrs .get ("bot_users" , set ()))
234238
235239 query_data = (
236240 pd .concat (query_data ).drop_duplicates (subset = ["id" ]).reset_index (drop = True )
0 commit comments