From dee9891bf481a3f4bcc7fd9c05148084eef0b2d9 Mon Sep 17 00:00:00 2001 From: Pierlou Date: Mon, 11 Mar 2024 13:59:06 +0100 Subject: [PATCH] fix: fix check --- .github/workflows/assert_version.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/.github/workflows/assert_version.py b/.github/workflows/assert_version.py index 9ae6bfd..ca3a9f8 100755 --- a/.github/workflows/assert_version.py +++ b/.github/workflows/assert_version.py @@ -2,7 +2,7 @@ import re import os -pattern = r'v?\d+.\d+.\d+' +pattern = r'v?\d+\.\d+\.\d+' def check(obj, version, parents=''): @@ -14,10 +14,9 @@ def check(obj, version, parents=''): errors = [] # if field is a string, we check for a potential version if isinstance(obj, str): - if homepage in obj: - tmp = re.search(pattern, obj) - if tmp and tmp[0] != version: - errors += [(parents, tmp[0])] + tmp = re.search(pattern, obj) + if tmp and tmp[0] != version: + errors += [(parents, tmp[0])] # if field is a list, we check every item elif isinstance(obj, list): for idx, k in enumerate(obj): @@ -29,11 +28,13 @@ def check(obj, version, parents=''): # if field is a dict, we check every value elif isinstance(obj, dict): for k in obj: - errors += check( - obj[k], - version, - parents=parents + '.' + k if parents else k - ) + # not checking the fields + if k != 'fields': + errors += check( + obj[k], + version, + parents=parents + '.' + k if parents else k + ) return errors @@ -60,7 +61,7 @@ def check(obj, version, parents=''): errors = check(schema, version) if errors: message = ( - f"Errors are mismatched within the schema '{schema}', " + f"Versions are mismatched within the schema '{schema['name']}', " f"expected version {version} but:" ) for e in errors: