import datetime

from github import Github
from github import Auth

activity_limit = datetime.datetime.now(tz=datetime.timezone.utc) - datetime.timedelta(days=2*365)
owner_name="jepler"
token = "github_pat_....."

auth = Auth.Token(token)

g = Github(auth=auth)

print(f"Archive repositories not active since {activity_limit}")
to_archive = []
for repo in g.get_user(owner_name).get_repos():
    if repo.archived: continue
    if repo.owner.login != owner_name: continue
    if not repo.fork: continue
    if repo.updated_at < activity_limit:
        print(f"A {repo.name} {repo.updated_at}")
        to_archive.append(repo)
        ### To actually do something, uncomment the following line:
        # repo.edit(archived=True)