Skip to content

Instantly share code, notes, and snippets.

@ansiwen
Forked from jd/auto-star-openstack-repo
Last active June 21, 2017 12:18
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 ansiwen/fcb9e630bcf636309298e2167775aee8 to your computer and use it in GitHub Desktop.
Save ansiwen/fcb9e630bcf636309298e2167775aee8 to your computer and use it in GitHub Desktop.
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