mirror of
https://github.com/lilydjwg/nvchecker.git
synced 2025-03-10 06:14:02 +00:00
gitea: omit default branch if not specified, fix for blm
This commit is contained in:
parent
a1d2a1325c
commit
4c4479d4ea
1 changed files with 5 additions and 3 deletions
|
@ -5,7 +5,7 @@ from __future__ import annotations
|
||||||
|
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
|
|
||||||
GITEA_URL = 'https://%s/api/v1/repos/%s/commits?sha=%s'
|
GITEA_URL = 'https://%s/api/v1/repos/%s/commits'
|
||||||
GITEA_MAX_TAG = 'https://%s/api/v1/repos/%s/tags'
|
GITEA_MAX_TAG = 'https://%s/api/v1/repos/%s/tags'
|
||||||
|
|
||||||
from nvchecker.api import (
|
from nvchecker.api import (
|
||||||
|
@ -17,14 +17,16 @@ async def get_version(
|
||||||
cache: AsyncCache, keymanager: KeyManager,
|
cache: AsyncCache, keymanager: KeyManager,
|
||||||
) -> VersionResult:
|
) -> VersionResult:
|
||||||
repo = urllib.parse.quote(conf['gitea'])
|
repo = urllib.parse.quote(conf['gitea'])
|
||||||
br = conf.get('branch', 'master')
|
br = conf.get('branch')
|
||||||
host = conf.get('host', 'gitea.com')
|
host = conf.get('host', 'gitea.com')
|
||||||
use_max_tag = conf.get('use_max_tag', False)
|
use_max_tag = conf.get('use_max_tag', False)
|
||||||
|
|
||||||
if use_max_tag:
|
if use_max_tag:
|
||||||
url = GITEA_MAX_TAG % (host, repo)
|
url = GITEA_MAX_TAG % (host, repo)
|
||||||
else:
|
else:
|
||||||
url = GITEA_URL % (host, repo, br)
|
url = GITEA_URL % (host, repo)
|
||||||
|
if br:
|
||||||
|
url += '?sha=' + br
|
||||||
|
|
||||||
# Load token from config
|
# Load token from config
|
||||||
token = conf.get('token')
|
token = conf.get('token')
|
||||||
|
|
Loading…
Add table
Reference in a new issue