-
-
Save KyMidd/69b8b49ee2e5a0d78fd333da90408968 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
# Set child team name | |
unset TEAMNAME | |
TEAMNAME="$PROJECT"$2 | |
echo Child team name will be $TEAMNAME | |
# Check if exist | |
unset CURL | |
CURL=$(curl -s \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer $GITHUB_TOKEN" \ | |
https://api.github.com/orgs/$ORG/teams/$TEAMNAME) | |
if [[ $(echo "$CURL" | grep "Not Found" | wc -l) -eq 1 ]]; then | |
echo "Team does not exist, create" | |
echo Creating team "$TEAMNAME" | |
unset CURL | |
CURL=$(curl -s \ | |
-X POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer $GITHUB_TOKEN" \ | |
https://api.github.com/orgs/$ORG/teams \ | |
-d "{\"name\":\"$TEAMNAME\",\"privacy\":\"closed\",\"parent_team_id\":$PARENT_TEAM_ID}" 2>&1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment