Skip to content

Commit ae69590

Browse files
committed
fix binary encoding issue
1 parent 95b2bcb commit ae69590

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

.github/workflows/scripts/check_rendered_specs.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ def generate_patch(
365365
content_diffs: list[dict],
366366
extra_files: list[str],
367367
missing_files: list[str],
368-
) -> str:
368+
) -> bytes:
369369
"""Generate a git patch covering all detected drift.
370370
371371
Uses `git add -N` to mark untracked (extra) files as intent-to-add,
@@ -374,7 +374,7 @@ def generate_patch(
374374
"""
375375
paths = [d["path"] for d in content_diffs] + extra_files + missing_files
376376
if not paths:
377-
return ""
377+
return b""
378378

379379
# Mark untracked files as intent-to-add so git diff includes them
380380
if extra_files:
@@ -388,9 +388,14 @@ def generate_patch(
388388
pass
389389

390390
try:
391-
patch = _git("diff", "--", *paths)
391+
result = subprocess.run(
392+
["git", "diff", "--", *paths],
393+
capture_output=True,
394+
check=True,
395+
)
396+
patch = result.stdout
392397
except subprocess.CalledProcessError:
393-
patch = ""
398+
patch = b""
394399

395400
# Undo the intent-to-add so we don't leave index dirty
396401
if extra_files:
@@ -544,7 +549,7 @@ def main() -> int:
544549
patch_content = generate_patch(content_diffs, extra, missing)
545550
if patch_content:
546551
args.patch.parent.mkdir(parents=True, exist_ok=True)
547-
args.patch.write_text(patch_content, encoding="utf-8")
552+
args.patch.write_bytes(patch_content)
548553
print(f"Patch written to {args.patch}")
549554

550555
# 4. Post comment or clean up (best-effort — exit code is authoritative)

0 commit comments

Comments
 (0)