truncate diff if longer than 60k
All checks were successful
Check flake.lock / Check health of `flake.lock` (pull_request) Successful in 42s
Check Nix formatting / Perform Nix format checks (pull_request) Successful in 3m24s
Check Nix flake / Perform Nix flake checks (pull_request) Successful in 6m12s

This commit is contained in:
ahuston-0 2025-05-27 10:57:12 -04:00
parent cf2a168ed5
commit 95620e20cc
No known key found for this signature in database
GPG Key ID: 47940175096C1330

View File

@ -12,13 +12,15 @@ def inject_diff():
out = []
with open(source_file,'r') as src:
src_content = src.read()
if len(src_content) > 60000:
logging.warning(f"{source_file} is longer than 60k characters, truncating")
src_content = src_content[:60000]
with open(target_file,'r') as tgt:
for line in tgt.readlines():
if placeholder in line:
out.append(line.replace(placeholder,src_content))
else:
out.append(line)
logging.info(out)
with open(target_file,'w') as tgt:
tgt.writelines(out)