def infos_from_giturl(url):
"""
retrieve the tag or branch from the URL parameter of the action
:param url: The URL parameter of the action
:return: tag or branch
"""
pattern = re.compile(
r'/(?P<owner>[^/]+)/(?P<name>[^/]+)/archive/(?P<tag>[^/]+)\.zip')
m = pattern.search(url)
if m:
d = m.groupdict()
if is_branch(d['tag']):
d['branch'] = d['tag']
d['version'] = None
d['branch_release'] = d['tag']
else:
d['branch'] = 'master'
d['branch_release'] = False
d['version'] = StrictVersion(d['tag'])
else:
d = dict(owner=None, name=None, tag=None,
branch=None, branch_release=None, version=None)
return d
评论列表
文章目录