Skip to content

Commit 1c511e9

Browse files
committed
include comments on issues as being active
1 parent fd04255 commit 1c511e9

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

scripts/move-to-emeritus.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ def check_approver_activity(usernames, repos, cutoff):
249249
on ANY repo in the team:
250250
- Added a comment on a PR
251251
- Approved / reviewed a PR
252+
- Added a comment on an issue
252253
Short-circuits: once a user is found active on one repo, they are
253254
not checked on the remaining repos.
254255
"""
@@ -274,12 +275,16 @@ def check_approver_activity(usernames, repos, cutoff):
274275
safe = "u_" + re.sub(r"[^a-zA-Z0-9]", "_", user)
275276
pr_comment_q = f'type:pr repo:{ORG}/{repo} commenter:{user} updated:>={cutoff}'
276277
review_q = f'type:pr repo:{ORG}/{repo} reviewed-by:{user} updated:>={cutoff}'
278+
issue_comment_q = f'type:issue repo:{ORG}/{repo} commenter:{user} updated:>={cutoff}'
277279
aliases.append(
278280
f'{safe}_pr_comments: search(query: "{pr_comment_q}", type: ISSUE, first: 1) {{ issueCount }}'
279281
)
280282
aliases.append(
281283
f'{safe}_reviews: search(query: "{review_q}", type: ISSUE, first: 1) {{ issueCount }}'
282284
)
285+
aliases.append(
286+
f'{safe}_issue_comments: search(query: "{issue_comment_q}", type: ISSUE, first: 1) {{ issueCount }}'
287+
)
283288

284289
query = "query { " + "\n".join(aliases) + " }"
285290
resp = request_with_retry("POST", GRAPHQL_API, data={"query": query})
@@ -296,7 +301,10 @@ def check_approver_activity(usernames, repos, cutoff):
296301
reviews = (data["data"].get(f"{safe}_reviews") or {}).get(
297302
"issueCount", 0
298303
)
299-
if pr_comments > 0 or reviews > 0:
304+
issue_comments = (data["data"].get(f"{safe}_issue_comments") or {}).get(
305+
"issueCount", 0
306+
)
307+
if pr_comments > 0 or reviews > 0 or issue_comments > 0:
300308
active.add(user)
301309
remaining.discard(user)
302310

@@ -316,6 +324,7 @@ def check_maintainer_activity(usernames, repos, cutoff):
316324
- Commented on PRs
317325
- Merged PRs
318326
- Authored PRs
327+
- Commented on issues
319328
Short-circuits once a user is found active.
320329
"""
321330
if not usernames or not repos:
@@ -341,6 +350,7 @@ def check_maintainer_activity(usernames, repos, cutoff):
341350
review_q = f'type:pr repo:{ORG}/{repo} reviewed-by:{user} updated:>={cutoff}'
342351
comment_q = f'type:pr repo:{ORG}/{repo} commenter:{user} updated:>={cutoff}'
343352
author_q = f'type:pr repo:{ORG}/{repo} author:{user} created:>={cutoff}'
353+
issue_comment_q = f'type:issue repo:{ORG}/{repo} commenter:{user} updated:>={cutoff}'
344354
aliases.append(
345355
f'{safe}_reviews: search(query: "{review_q}", type: ISSUE, first: 1) {{ issueCount }}'
346356
)
@@ -350,6 +360,9 @@ def check_maintainer_activity(usernames, repos, cutoff):
350360
aliases.append(
351361
f'{safe}_authored: search(query: "{author_q}", type: ISSUE, first: 1) {{ issueCount }}'
352362
)
363+
aliases.append(
364+
f'{safe}_issue_comments: search(query: "{issue_comment_q}", type: ISSUE, first: 1) {{ issueCount }}'
365+
)
353366

354367
query = "query { " + "\n".join(aliases) + " }"
355368
resp = request_with_retry("POST", GRAPHQL_API, data={"query": query})
@@ -369,7 +382,10 @@ def check_maintainer_activity(usernames, repos, cutoff):
369382
authored = (data["data"].get(f"{safe}_authored") or {}).get(
370383
"issueCount", 0
371384
)
372-
if reviews > 0 or pr_comments > 0 or authored > 0:
385+
issue_comments = (data["data"].get(f"{safe}_issue_comments") or {}).get(
386+
"issueCount", 0
387+
)
388+
if reviews > 0 or pr_comments > 0 or authored > 0 or issue_comments > 0:
373389
active.add(user)
374390
remaining.discard(user)
375391

0 commit comments

Comments
 (0)