Skip to content
Open
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: 11 additions & 0 deletions .github/workflows/validate_modified_targets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
# Safely extract the file from the PR's head and the merge-base commit
git show pr:sherlock_project/resources/data.json > data.json.head
git show $MERGE_BASE:sherlock_project/resources/data.json > data.json.base
git show $MERGE_BASE:sherlock_project/resources/data.schema.json > data.schema.json.base

# CRITICAL FIX: Overwrite the checked-out data.json with the one from the PR
# This ensures that pytest runs against the new, updated file.
Expand All @@ -59,15 +60,25 @@ jobs:
python - <<'EOF'
import json
import sys
from jsonschema import validate, SchemaError, ValidationError
try:
with open("data.json.base") as f: base = json.load(f)
with open("data.schema.json.base") as f: schema = json.load(f)
with open("data.json.head") as f: head = json.load(f)

validate(instance=head, schema=schema)
except FileNotFoundError as e:
print(f"Error: Could not find {e.filename}", file=sys.stderr)
sys.exit(1)
except json.JSONDecodeError as e:
print(f"Error: Could not decode JSON from a file - {e}", file=sys.stderr)
sys.exit(1)
except jsonschema.exceptions.SchemaError as e:
print(f"Error: Could not locate local JSON schema for validation - {e}", file=sys.stderr)
sys.exit(1)
except jsonschema.exceptions.ValidationError as e:
print(f"Error: Could not validate remote manifest against local schema - {e}", file=sys.stderr)
sys.exit(1)

changed = []
for k, v in head.items():
Expand Down