Skip to content

Commit

Permalink
Request reviews instead of assigning
Browse files Browse the repository at this point in the history
  • Loading branch information
Rocketknight1 committed Jan 22, 2025
1 parent 8b20315 commit 580aa71
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions .github/scripts/assign_reviewers.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ def main():
pr_number = event['pull_request']['number']
pr = repo.get_pull(pr_number)

existing_reviews = list(pr.get_reviews())
if existing_reviews:
print(f"Already has reviews: {[r.user.login for r in existing_reviews]}")
return

users_requested, teams_requested = pr.get_review_requests()
users_requested = list(users_requested)
if users_requested:
Expand All @@ -54,9 +59,9 @@ def main():
print("Top owners", top_owners)
for owner, _ in top_owners:
try:
pr.add_to_assignees(owner.removeprefix('@'))
pr.create_review_request(owner.removeprefix('@'))
except github.GithubException as e:
print(f"Failed to assign {owner}: {e}")
print(f"Failed to request review from {owner}: {e}")



Expand Down

0 comments on commit 580aa71

Please sign in to comment.