Created
January 3, 2022 17:21
-
-
Save a11ce/72d8136069ca1f1667127bf239e9c358 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# no set -e because gh might 404 | |
set -uo pipefail | |
IFS=$'\n\t' | |
if test "$#" -ne 2; then | |
echo "run as ./github-add-collabs.sh user/repo usernames.txt" | |
exit | |
fi | |
while read username; do | |
echo "adding $username..." | |
gh api --silent -XPUT "repos/$1/collaborators/$username" -f permission=push | |
if test "$?" -ne 0; then | |
echo -e "\033[0;31m!!!! could not find $username\033[0m" | |
fi | |
done < $2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment