This Node.js script automatically unfollows all users on GitHub you are following, with the option to maintain a whitelist of users that you do not want to unfollow.
To use this script, you need to have Node.js installed. If you do not have Node.js installed, you can download it from nodejs.org.
Once Node.js is installed, clone this repository to your local machine and install the dependencies with the following commands:
git clone git@github.com:thiagopac/github-unfollow-all-js.git
cd github-unfollow-all-js
npm install
To authenticate with the GitHub API, you will need to create a Personal Access Token. Follow these steps to create one:
-
Go to your GitHub account settings.
-
Scroll down to the Developer settings section and select Personal access tokens.
-
Click on the Generate new token dropdown and select Generate new token (classic).
-
Give your token a descriptive name.
-
In the Select scopes section, ensure that you check the
user
>user:follow
permission to allow the script to manage following and unfollowing. -
Once the token is created, make sure to copy it to your clipboard.
Important: Treat your tokens like passwords and keep them secret. Do not share your tokens in public spaces, and do not include them in your repository.
To run the script, use the following command in the terminal, replacing <YOUR-TOKEN>
with the Personal Access Token you generated and user1 user2 user3
with the GitHub usernames you want to keep following (your whitelist):
node src/unfollow.js <YOUR-TOKEN> user1 user2 user3
or simply use the start script (npm start <YOUR-TOKEN> user1 user2 user3)
The script will unfollow everyone, except for the ones listed in the whitelist.
Contributions to this project are welcome. You can contribute by:
-
Suggesting new features
-
Submitting pull requests
This project is licensed under the ISC License.