Skip to content

Commit a4fb199

Browse files
authored
Merge branch 'main' into feature-branch
2 parents e4df56e + e88a2da commit a4fb199

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

bin/annotation_workflow.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
import json
2-
from pathlib import Path
2+
import os
33
import re
4+
from pathlib import Path
45

56
# Function to print GitHub action notice
67
def print_github_action_notice(file, url):
78
print(f"::warning file={file},line=1::Annotation: {url}")
89

910
# Read specification URLs from JSON file
10-
with open("specification_urls.json", "r") as f:
11+
with open("bin/specification_urls.json", "r") as f:
1112
urls = json.load(f)
1213

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
18-
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)
19+
1920
# Read the file content
20-
with open(file_path, "r") as f:
21+
with open(file_path, 'r', encoding='utf-8') as f:
2122
changed_file_content = f.read()
2223

2324
# Parse JSON content
@@ -27,7 +28,7 @@ def print_github_action_notice(file, url):
2728
if "specification" in test:
2829
for specification_object in test["specification"]:
2930
for spec, section in specification_object.items():
30-
draft = root.split('/')[-1]
31+
draft = Path(file_path).parent.name
3132
if spec in ["core", "validation", "hyper-schema"]:
3233
print_github_action_notice(file_path, urls[draft][spec] + section)
3334
elif spec in ["quote"]:

0 commit comments

Comments
 (0)