INNER CODE UNIT · Python
tag_dates
lissy93/portainer-templates · lib/changelog.py:48
def tag_dates():
"""Map of tag -> creation date (YYYY-MM-DD)"""
lines = git('for-each-ref', '--format=%(refname:short) %(creatordate:short)',
'refs/tags').splitlines()
return dict(line.split(' ', 1) for line in lines if ' ' in line)
def templates_at(tag):
"""Templates in templates.json at a tag, keyed by title with `id` dropped.
Returns None if the file doesn't exist at that tag."""
try:
raw = git('show', f'{tag}:templates.json')
except subprocess.CalledProcessError:
return None
templates = json.loads(raw).get('templates', [])
return {t['title']: {k: v for k, v in t.items() if k != 'id'}
for t in templates if isinstance(t, dict) and 'title' in t}
def by_name(template):