mirror of
https://github.com/lilydjwg/nvchecker.git
synced 2025-03-10 06:14:02 +00:00
github: implement the include_tags_pattern pattern, closes #70
This commit is contained in:
parent
1be2f5fe80
commit
317ff6d97a
1 changed files with 8 additions and 2 deletions
|
@ -1,7 +1,8 @@
|
|||
# MIT licensed
|
||||
# Copyright (c) 2013-2017 lilydjwg <lilydjwg@gmail.com>, et al.
|
||||
# Copyright (c) 2013-2018 lilydjwg <lilydjwg@gmail.com>, et al.
|
||||
|
||||
import os
|
||||
import re
|
||||
|
||||
import structlog
|
||||
|
||||
|
@ -19,6 +20,7 @@ async def get_version(name, conf):
|
|||
br = conf.get('branch')
|
||||
use_latest_release = conf.getboolean('use_latest_release', False)
|
||||
use_max_tag = conf.getboolean('use_max_tag', False)
|
||||
include_tags_pattern = conf.get("include_tags_pattern", "")
|
||||
ignored_tags = conf.get("ignored_tags", "").split()
|
||||
sort_version_key = sort_version_keys[conf.get("sort_version_key", "parse_version")]
|
||||
if use_latest_release:
|
||||
|
@ -49,10 +51,14 @@ async def get_version(name, conf):
|
|||
version = data['tag_name']
|
||||
elif use_max_tag:
|
||||
data = [tag["name"] for tag in data if tag["name"] not in ignored_tags]
|
||||
if include_tags_pattern:
|
||||
data = [x for x in data
|
||||
if re.search(include_tags_pattern, x)]
|
||||
data.sort(key=sort_version_key)
|
||||
if not len(data):
|
||||
logger.error('No tag found in upstream repository.',
|
||||
name=name)
|
||||
name=name,
|
||||
include_tags_pattern=include_tags_pattern)
|
||||
return
|
||||
version = data[-1]
|
||||
else:
|
||||
|
|
Loading…
Add table
Reference in a new issue