From 8945b3b5e336a42972448e2f07ed5bc465a40c83 Mon Sep 17 00:00:00 2001 From: Matt Sturgeon Date: Wed, 31 Jul 2024 12:54:55 +0100 Subject: [PATCH] flake/generate-files: fix `--commit` line count `echo` pipes all its output at once, so `wc -l` always counts 1 line. See https://stackoverflow.com/questions/60954221 --- flake-modules/updates/default.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/flake-modules/updates/default.nix b/flake-modules/updates/default.nix index 55e0d0c5..3035e147 100644 --- a/flake-modules/updates/default.nix +++ b/flake-modules/updates/default.nix @@ -57,7 +57,8 @@ ) # Construct the commit message based on the body - count=$(echo -n "$body" | wc -l) + # NOTE: Can't use `wc -l` due to how `echo` pipes its output + count=$(echo -n "$body" | awk 'END {print NR}') if [ "$count" -gt 1 ] || [ ''${#body} -gt 50 ]; then msg=$(echo -e "generated: Update\n\n$body") else