aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Stellard <tstellar@redhat.com>2026-02-05 16:50:58 -0800
committerTom Stellard <tstellar@redhat.com>2026-02-05 16:51:42 -0800
commit50908434ab573647460e425e765fdd0be37fd4ac (patch)
treecb3176a41680b811e9e5e2ea6df8b903f6863281
parentb03496a151487c20e134fc2601d0d36e2095093d (diff)
downloadllvm-users/tstellar/commit-access-review-debug.zip
llvm-users/tstellar/commit-access-review-debug.tar.gz
llvm-users/tstellar/commit-access-review-debug.tar.bz2
-rw-r--r--.github/workflows/commit-access-review.py40
1 files changed, 37 insertions, 3 deletions
diff --git a/.github/workflows/commit-access-review.py b/.github/workflows/commit-access-review.py
index 73a140a..ae5c274 100644
--- a/.github/workflows/commit-access-review.py
+++ b/.github/workflows/commit-access-review.py
@@ -98,7 +98,7 @@ def check_manual_requests(
hasNextPage
endCursor
}
- }
+ }
}
"""
formatted_start_date = start_date.strftime("%Y-%m-%dT%H:%M:%S")
@@ -231,6 +231,14 @@ def count_prs(gh: github.Github, triage_list: dict, start_date: datetime.datetim
``triage_list`` with the number of PRs merged for each user.
"""
+ # We check for reviewers (commentors) for each PR here beacuase it is
+ # cheap. The check is not perfect, because we only consider merged PRs
+ # and we only look at the first 100 comments.
+ # We do a more accurate query for reviewers later, but doing it here helps
+ # us to cheaply identify people who meet the requirements giving us less
+ # users to process with the more expensive query later.
+ # We only process 25 PRs at a time to cut down on the risk of one of the
+ # queries taking too long and crashing the script.
query = """
query ($query: String!, $after: String) {
rateLimit {
@@ -239,7 +247,7 @@ def count_prs(gh: github.Github, triage_list: dict, start_date: datetime.datetim
resetAt
limit
}
- search(query: $query, type: ISSUE, first: 100, after: $after) {
+ search(query: $query, type: ISSUE, first: 25, after: $after) {
issueCount,
nodes {
... on PullRequest {
@@ -249,6 +257,13 @@ def count_prs(gh: github.Github, triage_list: dict, start_date: datetime.datetim
mergedBy {
login
}
+ comments(first: 100) {
+ nodes {
+ author {
+ login
+ }
+ }
+ }
}
}
pageInfo {
@@ -279,8 +294,26 @@ def count_prs(gh: github.Github, triage_list: dict, start_date: datetime.datetim
for pr in data["search"]["nodes"]:
# Users can be None if the user has been deleted.
if not pr["author"]:
+ author = None
+ else:
+ author = pr["author"]["login"]
+
+ # Check for reviewers
+ #print(f"There are {len(pr['comments']['nodes'])} comments")
+ for comment in pr["comments"]["nodes"]:
+ # Users can be NULL if they are deleted.
+ if not comment["author"]:
+ continue
+ reviewer = comment["author"]["login"]
+ # Can't review your own PR
+ if reviewer == author:
+ continue
+ if reviewer in triage_list:
+ triage_list[reviewer].add_reviewed(1)
+
+ # Check for authors
+ if not author:
continue
- author = pr["author"]["login"]
if author in triage_list:
triage_list[author].add_authored()
@@ -306,6 +339,7 @@ def main():
org = gh.get_organization("llvm")
repo = org.get_repo("llvm-project")
one_year_ago = datetime.datetime.now() - datetime.timedelta(days=365)
+ one_week_ago = datetime.datetime.now() - datetime.timedelta(days=7)
triage_list = {}
for collaborator in repo.get_collaborators(permission="push"):
triage_list[collaborator.login] = User(collaborator.login, triage_list)