mirror of
https://github.com/lilydjwg/nvchecker.git
synced 2025-03-10 06:14:02 +00:00
added path to github source
This commit is contained in:
parent
2f24822c88
commit
620c7a89cd
3 changed files with 16 additions and 1 deletions
|
@ -249,6 +249,9 @@ github
|
||||||
branch
|
branch
|
||||||
Which branch to track? Default: ``master``.
|
Which branch to track? Default: ``master``.
|
||||||
|
|
||||||
|
path
|
||||||
|
Only commits containing this file path will be returned.
|
||||||
|
|
||||||
use_latest_release
|
use_latest_release
|
||||||
Set this to ``true`` to check for the latest release on GitHub. An annotated
|
Set this to ``true`` to check for the latest release on GitHub. An annotated
|
||||||
tag creates a "release" on GitHub. It's not the same with git tags, which
|
tag creates a "release" on GitHub. It's not the same with git tags, which
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
|
from urllib.parse import urlencode
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
import structlog
|
import structlog
|
||||||
|
@ -26,6 +27,7 @@ async def get_version(name, conf, **kwargs):
|
||||||
async def get_version_real(name, conf, **kwargs):
|
async def get_version_real(name, conf, **kwargs):
|
||||||
repo = conf.get('github')
|
repo = conf.get('github')
|
||||||
br = conf.get('branch')
|
br = conf.get('branch')
|
||||||
|
path = conf.get('path')
|
||||||
use_latest_release = conf.getboolean('use_latest_release', False)
|
use_latest_release = conf.getboolean('use_latest_release', False)
|
||||||
use_max_tag = conf.getboolean('use_max_tag', False)
|
use_max_tag = conf.getboolean('use_max_tag', False)
|
||||||
include_tags_pattern = conf.get("include_tags_pattern", "")
|
include_tags_pattern = conf.get("include_tags_pattern", "")
|
||||||
|
@ -37,8 +39,12 @@ async def get_version_real(name, conf, **kwargs):
|
||||||
url = GITHUB_MAX_TAG % repo
|
url = GITHUB_MAX_TAG % repo
|
||||||
else:
|
else:
|
||||||
url = GITHUB_URL % repo
|
url = GITHUB_URL % repo
|
||||||
|
parameters = {}
|
||||||
if br:
|
if br:
|
||||||
url += '?sha=' + br
|
parameters['sha'] = br
|
||||||
|
if path:
|
||||||
|
parameters['path'] = path
|
||||||
|
url += '?' + urlencode(parameters)
|
||||||
headers = {
|
headers = {
|
||||||
'Accept': 'application/vnd.github.quicksilver-preview+json',
|
'Accept': 'application/vnd.github.quicksilver-preview+json',
|
||||||
'User-Agent': 'lilydjwg/nvchecker',
|
'User-Agent': 'lilydjwg/nvchecker',
|
||||||
|
|
|
@ -23,6 +23,12 @@ async def test_github_max_tag(get_version):
|
||||||
async def test_github_max_tag_with_ignored_tags(get_version):
|
async def test_github_max_tag_with_ignored_tags(get_version):
|
||||||
assert await get_version("example", {"github": "harry-sanabria/ReleaseTestRepo", "use_max_tag": 1, "ignored_tags": "second_release release3"}) == "first_release"
|
assert await get_version("example", {"github": "harry-sanabria/ReleaseTestRepo", "use_max_tag": 1, "ignored_tags": "second_release release3"}) == "first_release"
|
||||||
|
|
||||||
|
async def test_github_with_path(get_version):
|
||||||
|
assert await get_version("example", {"github": "petronny/ReleaseTestRepo", "path": "test_directory"}) == "20140122.012101"
|
||||||
|
|
||||||
|
async def test_github_with_path_and_branch(get_version):
|
||||||
|
assert await get_version("example", {"github": "petronny/ReleaseTestRepo", "branch": "test", "path": "test_directory/test_directory"}) == "20190128.113201"
|
||||||
|
|
||||||
async def test_github_max_tag_with_include(get_version):
|
async def test_github_max_tag_with_include(get_version):
|
||||||
version = await get_version("example", {
|
version = await get_version("example", {
|
||||||
"github": "EFForg/https-everywhere",
|
"github": "EFForg/https-everywhere",
|
||||||
|
|
Loading…
Add table
Reference in a new issue