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"