Created
August 22, 2016 07:54
-
-
Save jirikuncar/b6d9299f83e5b8fb917ff025a3c7c534 to your computer and use it in GitHub Desktop.
GitHub: number of commits since last tag
This file contains hidden or 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 sys | |
from getpass import getpass | |
import github3 | |
def main(_, username, name='inveniosoftware'): | |
gh = github3.login(username, password=getpass()) | |
org = gh.organization(name) | |
for repo in org.repositories(): | |
tags = list(repo.tags(1)) | |
if not tags: | |
print '[no release]', repo | |
continue | |
tag_sha = tags[0].commit['sha'] | |
new_commits = [ | |
c.commit.message.split('\n')[0] | |
for c in repo.commits(tag_sha, number=3) | |
] | |
if len(new_commits) > 2: | |
print '[new commits]', repo | |
else: | |
if len(new_commits) == 1 or \ | |
new_commits[1] != 'version: post-release bump': | |
print '[version bump needed]', repo | |
continue | |
print repo | |
if __name__ == '__main__': | |
main(*sys.argv) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment