ci(slash-cmd): allow repo write-permission users to /rerun-ut (#21120)
This commit is contained in:
@@ -711,6 +711,19 @@ def main():
|
|||||||
user_perms["can_rerun_failed_ci"] = True
|
user_perms["can_rerun_failed_ci"] = True
|
||||||
user_perms["can_rerun_ut"] = 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:
|
if not user_perms:
|
||||||
print(f"User {user_login} does not have any configured permissions. Exiting.")
|
print(f"User {user_login} does not have any configured permissions. Exiting.")
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user