Remove projects we accidentally added

Hello @katarinabouma
please save the following as script.sh

TOKEN="x"
ORG="MyOrgName"
URL_SUFFIX="/enable?circle-token="$TOKEN
URL_PREFIX="https://circleci.com/api/v1.1/project/github/"$ORG"/"

while IFS='' read -r repo || [[ -n "$repo" ]]; do
    sleep 2
    curl -X "DELETE" $URL_PREFIX$repo$URL_SUFFIX
done < "$1"

Enter your user token and pass in a list of repos as an argument like this:

repos.txt

repo1
repo2
repo3

run as: ./script.sh repos.txt

This will easily mass unfollow and remove accidentally added projects.

1 Like