Skip to content

Instantly share code, notes, and snippets.

@adithya2306
Last active February 4, 2024 04:41
Show Gist options
  • Save adithya2306/7396ae479767708ede9c2ddab84363fa to your computer and use it in GitHub Desktop.
Save adithya2306/7396ae479767708ede9c2ddab84363fa to your computer and use it in GitHub Desktop.
#!/usr/bin/python3
from github import Github # requires pip3 install pygithub
g = Github(input("Enter token: "))
org = g.get_organization(input("Enter org name: "))
branch = input("Enter branch: ")
for repo in org.get_repos():
try:
repo.edit(default_branch=branch)
print(repo.name, "success")
except:
print(repo.name, "failed")
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment