This script removes all external collaborators in a GitHub organisation. Collaborators look like a good idea when you have a small organisation and you don't want to start managing a lot of teams. Once your organisation grows collaborators are a nightmare to manage. There is little or no context about why they have access, they're often missed when auditing user access and they get forgotten about.
- Run
pip install requests
to install the one and only dependency - Configure the
GITHUB_ORG
andGITHUB_TOKEN
environment variables
Run the script like so python3 ./remove-collaborators.py
. The output should look like this:
No outside collaborators found.
DONE
If you have collaborators it will remove all of them and your output will look similar to:
Removed BigBird
Removed CookieMonster
Removed Ernie
No outside collaborators found.
DONE
Hopefully you only see that once.