Skip to content

Instantly share code, notes, and snippets.

@darkf
Created March 20, 2017 13:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darkf/72beac84e508ce1f38e8588379c1ea98 to your computer and use it in GitHub Desktop.
Save darkf/72beac84e508ce1f38e8588379c1ea98 to your computer and use it in GitHub Desktop.
A quick script for seeing the intersection between contributors to different GitHub repositories
from github import Github
from collections import Counter
import sys
USER = None
PASSWORD = None
def get_repo(repo_name):
contribs = list(g.get_repo(repo_name).get_contributors())
return {'contribs': [c.login for c in contribs]}
g = Github(USER, PASSWORD)
repos = [get_repo(r) for r in sys.argv[1:]]
print("Contributors in all of:", ", ".join(sys.argv[1:]))
contribs = set(repos[0]["contribs"])
for repo in repos[1:]:
contribs &= set(repo["contribs"])
for contrib in contribs:
print("-", contrib)
print("")
print("Furthermore, the most nomadic contributors:")
print("")
nomadic = Counter()
for repo in repos:
for contrib in repo["contribs"]:
nomadic[contrib] += 1
for (user, n) in nomadic.most_common():
print("- %s (%d repositories)" % (user, n))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment