How to mass unfollow projects from CircleCI

Introduction

To stop building a single project, visit the settings page for that repository and click Stop Building.

To unfollow multiple projects at once, use the CircleCI API with the bash script provided below.

Prerequisites

You must use a Personal API token (not a Project API token) to access all projects.

Instructions

Create the Script

Save the following as script.sh:

TOKEN="xx"

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"
```

Replace `$TOKEN` with your personal API token and `$ORG` with your organization name.

**Create the Repository List**

Create a text file with repository names (one per line, no commas):
```
repo1
repo2
repo3

Run the Script

Execute the script:

./script.sh repos.txt

Outcome

The script will unfollow and stop building all listed projects.

 

Additional Resources

Was this article helpful?
0 out of 4 found this helpful

Comments

0 comments

Article is closed for comments.