1
1
import json
2
- from pathlib import Path
2
+ import os
3
3
import re
4
+ from pathlib import Path
4
5
5
6
# Function to print GitHub action notice
6
7
def print_github_action_notice (file , url ):
@@ -10,13 +11,13 @@ def print_github_action_notice(file, url):
10
11
with open ("bin/specification_urls.json" , "r" ) as f :
11
12
urls = json .load (f )
12
13
13
- # Iterate through files in tests folder
14
- for root , dirs , files in Path ("tests" ). walk ( ):
15
- for file in files :
16
- if file .endswith (' .json' ): # Check if file is JSON
17
- file_path = root / file
14
+ # Iterate through JSON files in tests folder and subdirectories
15
+ for root , dirs , files in os . walk ("tests" ):
16
+ for file_name in files :
17
+ if file_name .endswith (" .json" ):
18
+ file_path = os . path . join ( root , file_name )
18
19
# Read the file content
19
- with open (file_path , "r" ) as f :
20
+ with open (file_path , 'r' , encoding = 'utf-8' ) as f :
20
21
changed_file_content = f .read ()
21
22
22
23
# Parse JSON content
@@ -26,7 +27,7 @@ def print_github_action_notice(file, url):
26
27
if "specification" in test :
27
28
for specification_object in test ["specification" ]:
28
29
for spec , section in specification_object .items ():
29
- draft = root . split ( '/' )[ - 1 ]
30
+ draft = Path ( file_path ). parent . name
30
31
if spec in ["core" , "validation" , "hyper-schema" ]:
31
32
print_github_action_notice (file_path , urls [draft ][spec ] + section )
32
33
elif spec in ["quote" ]:
0 commit comments