Allow force push on all Gitlab respositories

Once I moved all my repos over to gitlab, I realized I needed to make some other unrelated changes to several. I then needed to force push the changes. Because gitlab blocks this by default, and I needed to do this on many repos, I used the following script. First grab a list of repo ids then use those to modify each via the gitlab API.

#!/bin/bash

# Get list of ids bellow
# curl "https://gitlab.com/api/v4/projects?private_token=<access_token>&simple=true&owned=true&pagination=keyset&per_page=100&order_by=id&sort=desc" | jq .[].id
# Use jq .[].name to get the names if needed to match id to name

gitlab_ids=( xxxxxxxx yyyyyyyyy zzzzzzzzz )

for i in "${gitlab_ids[@]}"
do

    echo "Processing: $i"
    curl --request DELETE --header "PRIVATE-TOKEN: <access_token>" "https://gitlab.com/api/v4/projects/$i/protected_branches/master"

    curl --request DELETE --header "PRIVATE-TOKEN: <access_token>" "https://gitlab.com/api/v4/projects/$i/protected_branches/main"

    curl --request POST --header "PRIVATE-TOKEN: <access_token>" "https://gitlab.com/api/v4/projects/$i/protected_branches?name=*&allow_force_push=true"

    sleep 0.2
done