This is a simple script to delete your forked repositories which have no additional commits. Because GitHub introduced additional limits to the free accounts, it makes sense to do some housekeeping.
- Create a personal access token with these permissions:
- Administration: Read and write
- Commit statuses: Read-only
- Contents: Read-only
- Metadata: Read-only
- Pull requests: Read-only
-
Add the token to your
.env
file asGITHUB_ACCESS_TOKEN
. -
Create a local virtual environment and install the requirements:
$ python3 -m venv venv
$ source venv/bin/activate
$ pip install -r requirements.txt
- Run the script to see what repositories would be deleted:
$ python main.py
Logged in with cleanunicorn
Can delete cleanunicorn/forge-std
- This is a destructive action. If you really want to delete the repositories, add the
--delete
flag:
$ python3 main.py --delete
Logged in with cleanunicorn
This will delete forks with no commits from the authenticated user. Are you sure? (y/n)
y
Deleting cleanunicorn/forge-std
Total forks: 32
Total forks with no commits by the authenticated user: 1