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
This commit is contained in:
Matt Sturgeon 2024-07-31 12:54:55 +01:00
parent 9314cd46f0
commit 8945b3b5e3
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299

View file

@ -57,7 +57,8 @@
) )
# Construct the commit message based on the body # 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 if [ "$count" -gt 1 ] || [ ''${#body} -gt 50 ]; then
msg=$(echo -e "generated: Update\n\n$body") msg=$(echo -e "generated: Update\n\n$body")
else else