Skip to content

Instantly share code, notes, and snippets.

@KyMidd

KyMidd/asdf.sh Secret

Created February 19, 2023 17:43
Show Gist options
  • Save KyMidd/732d1ea709606c36457863e2682acba4 to your computer and use it in GitHub Desktop.
Save KyMidd/732d1ea709606c36457863e2682acba4 to your computer and use it in GitHub Desktop.
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