Skip to content

Instantly share code, notes, and snippets.

@johl
Created November 27, 2010 22:03
Show Gist options
  • Save johl/718326 to your computer and use it in GitHub Desktop.
Save johl/718326 to your computer and use it in GitHub Desktop.
import re
from github2.client import Github
def get_last_commit():
last_commits = []
github = Github(username="xxx", api_token="xxx")
for repo in github.repos.list() + github.repos.pushable():
for branch in github.repos.branches(repo.project):
commits = github.commits.list(repo.project, branch)
for commit in commits:
if commit.author['login'] == "xxx":
work_or_not = "It was not work-related."
if re.match('MyCompanyName',str(repo.project)):
work_or_not = "It was work-related."
last_commits.append([commit.authored_date, work_or_not])
last = sorted(last_commits)[-1]
work_or_not = last[-1]
date_time = last[0]
return (date_time, work_or_not)
@johl
Copy link
Author

johl commented Nov 28, 2010

Good find. Will do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment