Last active
September 2, 2020 14:16
-
-
Save gormih/49c66391537521c8c302ce947cd7056b to your computer and use it in GitHub Desktop.
Remove user from all repositories, exclude allowed owners.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from github import Github | |
def go_github(): | |
allowed_acc = ['allowed_friend1', 'allowed_friend2', 'username'] | |
account = Github("username", "password") | |
for repo in account.get_user().get_repos(): | |
owner = repo.owner.login | |
if owner not in allowed_acc: | |
print(owner) | |
repo.remove_from_collaborators('username') | |
if __name__ == '__main__': | |
go_github() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Gist using pyGitHub lib. https://github.com/PyGithub/PyGithub