Created
October 14, 2016 16:32
-
-
Save AndreaCrotti/f2c01f8ad2fc6db6e7ffe268a7eb72a8 to your computer and use it in GitHub Desktop.
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
def get_last_tag(repo): | |
"""Return last tag object ordering by date of the commit | |
""" | |
try: | |
return sorted(repo.tags, key=lambda t: t.commit.authored_date, reverse=True)[0] | |
except IndexError: | |
raise NoTags("There are no tags in this repository, add a first valid one with `git tag 0.0.1`") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment