Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions .github/validate_json.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import json
import jstyleson
import glob
import os
import sys
import urllib.request

from ignore_json import ignore

Expand All @@ -11,14 +10,16 @@
for filename in glob.glob(os.path.join('.', '*.json')):
if filename not in ignore:
print(f"Opening: {filename}")
filecontent = open(filename, "r").read()

with open(filename, "r") as file:
filecontent = file.read()

try:
json.loads(filecontent)
jstyleson.loads(filecontent)
print(f"✅ JSON valid")
except Exception as err:
error = True
print(f"❌ JSON invalid:")
print(f"❌ JSON invalid in {filename}:")
print(str(err))

if error:
Expand Down
20 changes: 14 additions & 6 deletions .github/validate_mod_json.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import json
import jstyleson
import glob
import os
import sys
Expand All @@ -12,21 +12,29 @@
if filename not in ignore:
print(f"Opening: {filename}")
filecontent = open(filename, "r").read()
modlist = json.loads(filecontent)

try:
modlist = jstyleson.loads(filecontent)
except Exception as err:
error = True
print(f"❌ Error reading JSON file {filename}: {err}")
continue

for mod, data in modlist.items():
url = data["mod"].replace(" ", "%20")
print(f"{mod}: {url}")
try:
response = urllib.request.urlopen(url)
print(f"✅ Download successful")
except:
except Exception as err:
error = True
print("❌ Download failed")
print(f"❌ Download failed: {err}")
continue

filecontent = response.read()

try:
json.loads(filecontent)
jstyleson.loads(filecontent)
print(f"✅ JSON valid")
except Exception as err:
error = True
Expand Down