Skip to content

Commit 2359635

Browse files
authored
workflows/commit-access-review: Exclude users who have recently requested access (llvm#119102)
Now that we are accepting commit access requests via GitHub issues, we can keep track of who has recently requested access.
1 parent 90d79ca commit 2359635

File tree

1 file changed

+26
-18
lines changed

1 file changed

+26
-18
lines changed

.github/workflows/commit-access-review.py

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -67,39 +67,47 @@ def check_manual_requests(
6767
) -> list[str]:
6868
"""
6969
Return a list of users who have been asked since ``start_date`` if they
70-
want to keep their commit access.
70+
want to keep their commit access or if they have applied for commit
71+
access since ``start_date``
7172
"""
73+
7274
query = """
73-
query ($query: String!) {
74-
search(query: $query, type: ISSUE, first: 100) {
75+
query ($query: String!, $after: String) {
76+
search(query: $query, type: ISSUE, first: 100, after: $after) {
7577
nodes {
7678
... on Issue {
77-
body
78-
comments (first: 100) {
79-
nodes {
80-
author {
81-
login
82-
}
83-
}
79+
author {
80+
login
8481
}
82+
body
8583
}
8684
}
85+
pageInfo {
86+
hasNextPage
87+
endCursor
88+
}
8789
}
8890
}
8991
"""
9092
formatted_start_date = start_date.strftime("%Y-%m-%dT%H:%M:%S")
9193
variables = {
92-
"query": f"type:issue created:>{formatted_start_date} org:llvm repo:llvm-project label:infra:commit-access"
94+
"query": f"type:issue created:>{formatted_start_date} org:llvm repo:llvm-project label:infra:commit-access,infra:commit-access-request"
9395
}
9496

95-
res_header, res_data = gh._Github__requester.graphql_query(
96-
query=query, variables=variables
97-
)
98-
data = res_data["data"]
97+
has_next_page = True
9998
users = []
100-
for issue in data["search"]["nodes"]:
101-
users.extend([user[1:] for user in re.findall("@[^ ,\n]+", issue["body"])])
102-
99+
while has_next_page:
100+
res_header, res_data = gh._Github__requester.graphql_query(
101+
query=query, variables=variables
102+
)
103+
data = res_data["data"]
104+
for issue in data["search"]["nodes"]:
105+
users.extend([user[1:] for user in re.findall("@[^ ,\n]+", issue["body"])])
106+
if issue["author"]:
107+
users.append(issue["author"]["login"])
108+
has_next_page = data["search"]["pageInfo"]["hasNextPage"]
109+
if has_next_page:
110+
variables["after"] = data["search"]["pageInfo"]["endCursor"]
103111
return users
104112

105113

0 commit comments

Comments
 (0)