Skip to content

Commit cc2f688

Browse files
committed
use maintain role to fetch collaborators as admin list
1 parent fcea388 commit cc2f688

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/customizable_continuous_integration/automations/commands/write_protection_hook.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
03/09/2024 Ryan, Gao Initial creation
99
17/09/2024 Ryan, Gao Add cross-forks check
1010
30/09/2024 Ryan, Gao Add support to use repo admin
11+
04/10/2024 Ryan, Gao Add maintainers into the admin list
1112
"""
1213

1314
import argparse
@@ -22,8 +23,10 @@
2223
from pre_commit.util import CalledProcessError, cmd_output
2324

2425
from customizable_continuous_integration.common_libs.github_apis import repository
26+
2527
FORKED_REPOSITORY_REMOTE_NAME = "downstream"
2628

29+
2730
def get_integration_test_logger() -> logging.Logger:
2831
_logger = logging.getLogger("write_protection_hook")
2932
logging_ch = logging.StreamHandler(sys.stdout)
@@ -83,7 +86,8 @@ def write_protection_command(cli_args: list[str]) -> None:
8386
head_ref = f"{FORKED_REPOSITORY_REMOTE_NAME}/{head_ref}"
8487
admin_list = args.admin_list
8588
if args.github_access_token and args.github_repository_name:
86-
admins = repository.get_repository_by_permission(args.github_access_token, args.github_repository_name, "admin")
89+
admins = repository.get_repository_by_permission(args.github_access_token, args.github_repository_name, "maintain")
90+
admins = list(set(admins))
8791
if admin_list:
8892
admins.append(admin_list)
8993
admin_list = ";".join(admins)

0 commit comments

Comments
 (0)