Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Automatically star any OpenStack Git repository which contains own commits
#!/usr/bin/env python
from github import Github
from getpass import getpass
USERNAME = raw_input("GitHub username: ")
PASSWORD = getpass()
ORGS = ("openstack", "stackforge", "openstack-dev", "openstack-infra")
g = Github(USERNAME, PASSWORD)
me = g.get_user()
for org in ORGS:
user = g.get_user(org)
for repo in user.get_repos():
commits = repo.get_commits(author=me)
if any(commits):
print("Starring %s" % repo.full_name)
me.add_to_starred(repo)
else:
print("Ignoring %s" % repo.full_name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment