mirror of
https://github.com/lilydjwg/nvchecker
synced 2024-12-11 17:29:32 +00:00
github: don't use master as default branch
This commit is contained in:
parent
7133ffc1a0
commit
c150b77b61
@ -1,4 +1,4 @@
|
||||
# MIT licensed
|
||||
# Copyright (c) 2013-2017 lilydjwg <lilydjwg@gmail.com>, et al.
|
||||
# Copyright (c) 2013-2018 lilydjwg <lilydjwg@gmail.com>, et al.
|
||||
|
||||
__version__ = '1.0'
|
||||
__version__ = '1.1dev'
|
||||
|
@ -7,7 +7,7 @@ import logging
|
||||
from . import session
|
||||
from ..sortversion import sort_version_keys
|
||||
|
||||
GITHUB_URL = 'https://api.github.com/repos/%s/commits?sha=%s'
|
||||
GITHUB_URL = 'https://api.github.com/repos/%s/commits'
|
||||
GITHUB_LATEST_RELEASE = 'https://api.github.com/repos/%s/releases/latest'
|
||||
GITHUB_MAX_TAG = 'https://api.github.com/repos/%s/tags'
|
||||
|
||||
@ -15,7 +15,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
async def get_version(name, conf):
|
||||
repo = conf.get('github')
|
||||
br = conf.get('branch', 'master')
|
||||
br = conf.get('branch')
|
||||
use_latest_release = conf.getboolean('use_latest_release', False)
|
||||
use_max_tag = conf.getboolean('use_max_tag', False)
|
||||
ignored_tags = conf.get("ignored_tags", "").split()
|
||||
@ -25,7 +25,9 @@ async def get_version(name, conf):
|
||||
elif use_max_tag:
|
||||
url = GITHUB_MAX_TAG % repo
|
||||
else:
|
||||
url = GITHUB_URL % (repo, br)
|
||||
url = GITHUB_URL % repo
|
||||
if br:
|
||||
url += '?sha=' + br
|
||||
headers = {
|
||||
'Accept': 'application/vnd.github.quicksilver-preview+json',
|
||||
'User-Agent': 'lilydjwg/nvchecker',
|
||||
|
@ -10,6 +10,9 @@ pytestmark = [pytest.mark.asyncio,
|
||||
async def test_github(get_version):
|
||||
assert await get_version("example", {"github": "harry-sanabria/ReleaseTestRepo"}) == "20140122.012101"
|
||||
|
||||
async def test_github_default_not_master(get_version):
|
||||
assert await get_version("example", {"github": "repos/MariaDB"}) is not None
|
||||
|
||||
async def test_github_latest_release(get_version):
|
||||
assert await get_version("example", {"github": "harry-sanabria/ReleaseTestRepo", "use_latest_release": 1}) == "release3"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user