Skip to content

Instantly share code, notes, and snippets.

@sbenthall
Created December 17, 2018 20:25
Show Gist options
  • Save sbenthall/14c4d14c00876440ba6d0ae62efa432f to your computer and use it in GitHub Desktop.
Save sbenthall/14c4d14c00876440ba6d0ae62efa432f to your computer and use it in GitHub Desktop.
import git
import os
import shutil
tmp_dir = "tmp_repo_dir"
def get_tags(org,repo):
shutil.rmtree(tmp_dir)
print("Getting tags for %s/%s" % (org, repo))
git_url= "git@github.com:%s/%s.git" % (org,repo)
if not os.path.exists(tmp_dir):
os.mkdir(tmp_dir)
repo = git.Repo.clone_from(git_url,tmp_dir)
print("%d tags" % (len(repo.tags)))
tags = [(tag.name,
tag.commit.author.name,
tag.commit.author.email,
tag.commit.committed_datetime)
for tag
in repo.tags]
shutil.rmtree(tmp_dir)
def main(org,repo):
get_tags(org,repo)
if __name__ == '__main__':
main(org="nodejs", repo="node")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment