mirror of
https://github.com/lilydjwg/nvchecker.git
synced 2025-03-10 06:14:02 +00:00
parent
8d3b6adaaa
commit
4eb70a0fbe
3 changed files with 32 additions and 2 deletions
|
@ -412,12 +412,19 @@ use_latest_release
|
||||||
small ones like `nvchecker's <https://github.com/lilydjwg/nvchecker/releases>`_
|
small ones like `nvchecker's <https://github.com/lilydjwg/nvchecker/releases>`_
|
||||||
are only git tags that should use ``use_max_tag`` below.
|
are only git tags that should use ``use_max_tag`` below.
|
||||||
|
|
||||||
Will return the release name instead of date.
|
Will return the release's tag name instead of date. (For historical reasons
|
||||||
|
it doesn't return the release name. See below to change.)
|
||||||
|
|
||||||
|
use_release_name
|
||||||
|
When ``use_latest_release`` is ``true``, setting this to ``true`` will cause
|
||||||
|
nvchecker to return the release name instead of the tag name.
|
||||||
|
|
||||||
include_prereleases
|
include_prereleases
|
||||||
When ``use_latest_release`` is ``true``, set this to ``true`` to take prereleases into
|
When ``use_latest_release`` is ``true``, set this to ``true`` to take prereleases into
|
||||||
account.
|
account.
|
||||||
|
|
||||||
|
This returns the release names (not the tag names).
|
||||||
|
|
||||||
This requires a token because it's using the v4 GraphQL API.
|
This requires a token because it's using the v4 GraphQL API.
|
||||||
|
|
||||||
use_latest_tag
|
use_latest_tag
|
||||||
|
|
|
@ -219,8 +219,15 @@ async def get_version_real(
|
||||||
if use_latest_release:
|
if use_latest_release:
|
||||||
if 'tag_name' not in data:
|
if 'tag_name' not in data:
|
||||||
raise GetVersionError('No release found in upstream repository.')
|
raise GetVersionError('No release found in upstream repository.')
|
||||||
|
|
||||||
|
use_release_name = conf.get('use_release_name', False)
|
||||||
|
if use_release_name:
|
||||||
|
version = data['name']
|
||||||
|
else:
|
||||||
|
version = data['tag_name']
|
||||||
|
|
||||||
return RichResult(
|
return RichResult(
|
||||||
version = data['tag_name'],
|
version = version,
|
||||||
gitref = f"refs/tags/{data['tag_name']}",
|
gitref = f"refs/tags/{data['tag_name']}",
|
||||||
url = data['html_url'],
|
url = data['html_url'],
|
||||||
)
|
)
|
||||||
|
|
|
@ -36,6 +36,22 @@ async def test_github_latest_release_include_prereleases(get_version):
|
||||||
"include_prereleases": True,
|
"include_prereleases": True,
|
||||||
}) == "v0.0.1-pre"
|
}) == "v0.0.1-pre"
|
||||||
|
|
||||||
|
async def test_github_latest_release_with_release_name(get_version):
|
||||||
|
version = await get_version("example", {
|
||||||
|
"source": "github",
|
||||||
|
"github": "mamba-org/mamba",
|
||||||
|
"use_latest_release": True,
|
||||||
|
})
|
||||||
|
assert version.startswith('20') # tag name
|
||||||
|
|
||||||
|
version = await get_version("example", {
|
||||||
|
"source": "github",
|
||||||
|
"github": "mamba-org/mamba",
|
||||||
|
"use_latest_release": True,
|
||||||
|
"use_release_name": True,
|
||||||
|
})
|
||||||
|
assert not version.startswith('20') # release name
|
||||||
|
|
||||||
async def test_github_max_tag(get_version):
|
async def test_github_max_tag(get_version):
|
||||||
assert await get_version("example", {
|
assert await get_version("example", {
|
||||||
"source": "github",
|
"source": "github",
|
||||||
|
|
Loading…
Add table
Reference in a new issue