Skip to content

Commit c34927a

Browse files
authored
commit-access-review.py: Remove new contributor check (#168629)
We don't need this anymore since all new contributors in the last year have applied for commit access using GitHub issues. There is already code in the script that removes anyone who submitted a request, so we don't need the old code any more (which was way too conservitave and very slow).
1 parent f859427 commit c34927a

File tree

1 file changed

+0
-81
lines changed

1 file changed

+0
-81
lines changed

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

Lines changed: 0 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -170,80 +170,6 @@ def get_num_commits(gh: github.Github, user: str, start_date: datetime.datetime)
170170
return count
171171

172172

173-
def is_new_committer_query_repo(
174-
gh: github.Github, user: str, start_date: datetime.datetime
175-
) -> bool:
176-
"""
177-
Determine if ``user`` is a new committer. A new committer can keep their
178-
commit access even if they don't meet the criteria.
179-
"""
180-
variables = {
181-
"user": user,
182-
}
183-
184-
user_query = """
185-
query ($user: String!) {
186-
user(login: $user) {
187-
id
188-
}
189-
}
190-
"""
191-
192-
res_header, res_data = gh._Github__requester.graphql_query(
193-
query=user_query, variables=variables
194-
)
195-
data = res_data["data"]
196-
variables["owner"] = "llvm"
197-
variables["user_id"] = data["user"]["id"]
198-
variables["start_date"] = start_date.strftime("%Y-%m-%dT%H:%M:%S")
199-
200-
query = """
201-
query ($owner: String!, $user_id: ID!){
202-
organization(login: $owner) {
203-
repository(name: "llvm-project") {
204-
ref(qualifiedName: "main") {
205-
target {
206-
... on Commit {
207-
history(author: {id: $user_id }, first: 5) {
208-
nodes {
209-
committedDate
210-
}
211-
}
212-
}
213-
}
214-
}
215-
}
216-
}
217-
}
218-
"""
219-
220-
res_header, res_data = gh._Github__requester.graphql_query(
221-
query=query, variables=variables
222-
)
223-
data = res_data["data"]
224-
repo = data["organization"]["repository"]
225-
commits = repo["ref"]["target"]["history"]["nodes"]
226-
if len(commits) == 0:
227-
return True
228-
committed_date = commits[-1]["committedDate"]
229-
if datetime.datetime.strptime(committed_date, "%Y-%m-%dT%H:%M:%SZ") < start_date:
230-
return False
231-
return True
232-
233-
234-
def is_new_committer(
235-
gh: github.Github, user: str, start_date: datetime.datetime
236-
) -> bool:
237-
"""
238-
Wrapper around is_new_commiter_query_repo to handle exceptions.
239-
"""
240-
try:
241-
return is_new_committer_query_repo(gh, user, start_date)
242-
except:
243-
pass
244-
return True
245-
246-
247173
def get_review_count(
248174
gh: github.Github, user: str, start_date: datetime.datetime
249175
) -> int:
@@ -383,13 +309,6 @@ def main():
383309

384310
print("After Commits:", len(triage_list), "triagers")
385311

386-
# Step 4 check for new committers
387-
for user in list(triage_list.keys()):
388-
print("Checking", user)
389-
if is_new_committer(gh, user, one_year_ago):
390-
print("Removing new committer: ", user)
391-
del triage_list[user]
392-
393312
print("Complete:", len(triage_list), "triagers")
394313

395314
with open("triagers.log", "w") as triagers_log:

0 commit comments

Comments
 (0)