Skip to content

Commit 2367412

Browse files
committed
Cases for rfc and iso written separately
1 parent 0b780b2 commit 2367412

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

bin/annotation_workflow.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import json
1+
import json, re
22
from pathlib import Path
33

44
def github_action_notice(file, url, line):
@@ -39,7 +39,7 @@ def find_test_line_number(test_content, test_name):
3939
# Iterate through JSON files in tests folder and subdirectories
4040
for file_path in Path("tests").rglob("*.json"):
4141
# 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:
4343
changed_file_content = f.read()
4444

4545
# Parse JSON content
@@ -56,10 +56,13 @@ def find_test_line_number(test_content, test_name):
5656
continue
5757
elif spec in ["core", "validation", "hyper-schema"]:
5858
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)
5963
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))
6366

6467
except json.JSONDecodeError:
6568
print(f"::error file={file_path}::Failed to parse JSON content")

0 commit comments

Comments
 (0)