From 1e97864d755153a401400d35429c2277a3578fc8 Mon Sep 17 00:00:00 2001 From: Liangsheng Yin Date: Sun, 22 Mar 2026 00:32:29 -0700 Subject: [PATCH] ci(slash-cmd): allow repo write-permission users to /rerun-ut (#21120) --- scripts/ci/utils/slash_command_handler.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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