From b7cbbe7b7b2e02607f9f41661921419ce7b253a9 Mon Sep 17 00:00:00 2001 From: UltimateCoder Date: Thu, 15 Oct 2026 22:03:00 +0200 Subject: [PATCH] fix: handle file paths with spaces xargs split paths on whitespace, so sed failed on files like '..._Removed MediaType Enum.cs' (exit 123). Pass the file list NUL-separated and only rewrite files containing {{BUILD_VAR_. A repo without any placeholder no longer fails on grep's exit 1. Co-Authored-By: Claude Opus 5.5 --- action.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index e5ed12e..2817527 100644 --- a/action.yml +++ b/action.yml @@ -50,4 +50,9 @@ runs: SED_ARGS+=(-e "s|{{${key}}}|${VARS[$key]}|g") done - grep -rIl --exclude-dir=.git '' . | xargs -r sed -i "${SED_ARGS[@]}" + # NUL-separated so paths with spaces survive; only touch files that contain placeholders. + # grep exits 1 when nothing matches, which is fine; 2 (real error) still fails. + FILES="$(mktemp)" + grep -rIlZ --exclude-dir=.git -F '{{BUILD_VAR_' . > "$FILES" || [ $? -eq 1 ] + xargs -0 -r sed -i "${SED_ARGS[@]}" < "$FILES" + rm -f "$FILES"