Skip to content

Commit 82d910f

Browse files
committed
sync_module_repo_members: Add global admins with admin permission level
GitHub API returns the effective/resultant permission for repository collaborators and this is always `admin` for the global admin/organisation owner users. This commit updates the module repository member sync script such that the global admin users are added with `admin` permission level to module repositories. Signed-off-by: Stephanos Ioannidis <[email protected]>
1 parent 9caa28a commit 82d910f

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

terraform/github-zephyrproject-rtos/scripts/sync_module_repo_members.sh

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ echo "${maintainers_data}" | yq &> /dev/null || (
4343
exit 10
4444
)
4545

46+
# Read global admin list
47+
global_admins=$(<${manifest_path}/global-admins.csv)
48+
global_admins=$(echo "${global_admins}" | tail -n +2)
49+
global_admins=(${global_admins})
50+
4651
# Get the maintainer data for modules (aka. west projects)
4752
readarray module_maintainer_entries < <(echo "${maintainers_data}" |
4853
yq -r -o=j -I=0 'with_entries(select(.key == "West project: *")) | to_entries()[]')
@@ -70,11 +75,19 @@ for module_maintainer_entry in "${module_maintainer_entries[@]}"; do
7075

7176
## Write maintainer entries
7277
for maintainer in ${maintainers}; do
73-
echo "user,${maintainer},maintain" >> ${collab_list_file}
78+
if [[ " ${global_admins[@]} " =~ " ${maintainer} " ]]; then
79+
echo "user,${maintainer},admin" >> ${collab_list_file}
80+
else
81+
echo "user,${maintainer},maintain" >> ${collab_list_file}
82+
fi
7483
done
7584

7685
## Write collaborator entries
7786
for collaborator in ${collaborators}; do
78-
echo "user,${collaborator},push" >> ${collab_list_file}
87+
if [[ " ${global_admins[@]} " =~ " ${collaborator} " ]]; then
88+
echo "user,${collaborator},admin" >> ${collab_list_file}
89+
else
90+
echo "user,${collaborator},push" >> ${collab_list_file}
91+
fi
7992
done
8093
done

0 commit comments

Comments
 (0)