Last active
December 2, 2019 10:52
-
-
Save sebastianha/9358027f5adc646fa848545811b71eac to your computer and use it in GitHub Desktop.
Unprotect all Branches in GitLab
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 | |
API_TOKEN="<TOKEN>" | |
API_URL="https://gitlab.com/api/v4" | |
for PROJECT_ID in {1..260}; do | |
echo "Working on Project: $PROJECT_ID" | |
for BRANCH in `curl -s --header "PRIVATE-TOKEN: ${API_TOKEN}" "${API_URL}/projects/${PROJECT_ID}/protected_branches" | jq -r ".[]|.name?"`; do | |
echo $BRANCH | |
curl -s --request DELETE --header "PRIVATE-TOKEN: ${API_TOKEN}" "${API_URL}/projects/${PROJECT_ID}/protected_branches/${BRANCH}" | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment