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 requeststo install the one and only dependency - Configure the
GITHUB_ORGandGITHUB_TOKENenvironment variables
Run the script like so python3 ./remove-collaborators.py. The output should look like this: