Skip to content

Instantly share code, notes, and snippets.

@fmartingr
Created October 7, 2019 19:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fmartingr/0a15681dd204ec7bd1774364a40e8338 to your computer and use it in GitHub Desktop.
Save fmartingr/0a15681dd204ec7bd1774364a40e8338 to your computer and use it in GitHub Desktop.
Remove all forked repositories on the user account that is nor archived
# pip install github3
import github3
USERNAME = ""
TOKEN = ""
gh = github3.login(username=USERNAME, token=TOKEN)
for repository in gh.repositories():
if repository.owner.login == USERNAME and repository.fork and not repository.archived:
print(f"Removing {'/'.join(repository.url.split('/')[-2:])}")
repository.delete()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment