-
-
Save KyMidd/732d1ea709606c36457863e2682acba4 to your computer and use it in GitHub Desktop.
This file contains 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
while IFS="," read -r GITHUB_USERNAME HQ_USERNAME | |
do | |
# Normalize casing | |
GITHUB_USERNAME=$(echo $GITHUB_USERNAME | tr '[A-Z]' '[a-z]') | |
HQ_USERNAME=$(echo $HQ_USERNAME | tr '[A-Z]' '[a-z]') | |
done < github_user_and_hq_username.csv | |
if [ -z "$GITHUB_USERNAME" ]; then | |
echo "☠️ GitHub username not found" | |
else | |
echo "- GitHub username for this user is: $GITHUB_USERNAME" | |
# Add user to team | |
unset CURL | |
CURL=$(curl -s \ | |
-X PUT \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer $GITHUB_TOKEN" \ | |
https://api.github.com/orgs/$ORG/teams/$TEAM_SLUG/memberships/$GITHUB_USERNAME \ | |
-d '{"role":"maintainer"}' 2>&1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment