Created
February 20, 2020 14:07
-
-
Save cidrblock/8b2b2c73103e48ce5bddfdf75bb23dfb to your computer and use it in GitHub Desktop.
This file contains hidden or 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 datetime import datetime, timezone | |
| import dateutil.parser | |
| from github3 import GitHub | |
| GITHUB_TOKEN = os.getenv('GITHUB_TOKEN') | |
| github = GitHub(token=GITHUB_TOKEN) | |
| org = github.organization('ansible-collection-migration') | |
| for repo in org.repositories(): | |
| last_pushed = repo.pushed_at | |
| age = datetime.now(timezone.utc) - dateutil.parser.isoparse(last_pushed) | |
| if age.days: | |
| print("Deleting %s %s" % (repo.name, age.days)) | |
| # repo.delete() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment