INNER CODE UNIT · Python
schema_root
bjw-s-labs/helm-charts · .ci/scripts/prepare-schema-refs.py:10
schema_root = (root / path).resolve()
if not schema_root.is_dir():
raise FileNotFoundError(f"Schema path not found: {schema_root}")
file_uri = root.resolve().as_uri().encode("ascii")
pattern = re.compile(
rb"https://raw\.githubusercontent\.com/"
+ re.escape(repository.encode("ascii"))
+ rb"/[^\"']*/(charts/[^\"']*)"
)
changed = 0
for schema_file in schema_root.rglob("*.json"):
if not schema_file.is_file():
continue
original = schema_file.read_bytes()
rewritten = pattern.sub(
lambda match: file_uri + b"/" + match.group(1), original
)
if rewritten != original: