Created
November 27, 2010 22:03
-
-
Save johl/718326 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Good find. Will do.