1
- import json
1
+ import json , re
2
2
from pathlib import Path
3
3
4
4
def github_action_notice (file , url , line ):
@@ -39,7 +39,7 @@ def find_test_line_number(test_content, test_name):
39
39
# Iterate through JSON files in tests folder and subdirectories
40
40
for file_path in Path ("tests" ).rglob ("*.json" ):
41
41
# Read the file content using pathlib.Path
42
- with file_path .open ('r' , encoding = ' utf-8' ) as f :
42
+ with file_path .open ("r" , encoding = " utf-8" ) as f :
43
43
changed_file_content = f .read ()
44
44
45
45
# Parse JSON content
@@ -56,10 +56,13 @@ def find_test_line_number(test_content, test_name):
56
56
continue
57
57
elif spec in ["core" , "validation" , "hyper-schema" ]:
58
58
url = urls [draft ][spec ].format (spec = spec , section = section )
59
+ elif re .match ("^rfc\\ d+$" , spec ):
60
+ url = urls ["rfc" ].format (spec = spec , section = section )
61
+ elif re .match ("^iso\\ d+$" , spec ):
62
+ url = urls ["iso" ].format (spec = spec , section = section )
59
63
else :
60
- url = urls [spec ].format (spec = spec , section = section )
61
- annotation = github_action_notice (file_path , url , line_number )
62
- print (annotation )
64
+ url = urls [spec ].format (spec = spec , section = section )
65
+ print (github_action_notice (file_path , url , line_number ))
63
66
64
67
except json .JSONDecodeError :
65
68
print (f"::error file={ file_path } ::Failed to parse JSON content" )
0 commit comments