Skip to content

Instantly share code, notes, and snippets.

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 jirikuncar/b6d9299f83e5b8fb917ff025a3c7c534 to your computer and use it in GitHub Desktop.
Save jirikuncar/b6d9299f83e5b8fb917ff025a3c7c534 to your computer and use it in GitHub Desktop.
GitHub: number of commits since last tag
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