diff --git a/scripts/ci/utils/slash_command_handler.py b/scripts/ci/utils/slash_command_handler.py index 582e68ed0..971c19bc4 100644 --- a/scripts/ci/utils/slash_command_handler.py +++ b/scripts/ci/utils/slash_command_handler.py @@ -711,6 +711,19 @@ def main(): user_perms["can_rerun_failed_ci"] = True user_perms["can_rerun_ut"] = True + # Users with write (or higher) permission on the repo can rerun UTs on any PR, + # even if they are not the PR author or listed in CI_PERMISSIONS.json. + if not user_perms or not user_perms.get("can_rerun_ut", False): + perm = repo.get_collaborator_permission(user_login) + if perm in ("admin", "write"): + print( + f"User {user_login} has '{perm}' repo permission. " + "Granting can_rerun_ut." + ) + if user_perms is None: + user_perms = {} + user_perms["can_rerun_ut"] = True + if not user_perms: print(f"User {user_login} does not have any configured permissions. Exiting.") return