From 3be86923f5d5d22fd10327c0707380be2b66fee3 Mon Sep 17 00:00:00 2001 From: Tw93 Date: Sun, 12 Oct 2025 17:58:11 +0800 Subject: [PATCH] Update shell-format.yml --- .github/workflows/shell-format.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/shell-format.yml b/.github/workflows/shell-format.yml index 15a4be6..98111e3 100644 --- a/.github/workflows/shell-format.yml +++ b/.github/workflows/shell-format.yml @@ -25,12 +25,18 @@ jobs: shell: bash run: | set -euo pipefail - mapfile -d '' FILES < <(git ls-files -z '*.sh' 'mole' || true) - if (( ${#FILES[@]} == 0 )); then + count=0 + : > files-null.list + while IFS= read -r -d '' f; do + printf '%s\0' "$f" >> files-null.list + count=$((count+1)) + done < <(git ls-files -z '*.sh' 'mole' || true) + + if [[ $count -eq 0 ]]; then echo "found=0" >> "$GITHUB_OUTPUT" + rm -f files-null.list else - printf '%s\0' "${FILES[@]}" > files-null.list - echo "found=${#FILES[@]}" >> "$GITHUB_OUTPUT" + echo "found=$count" >> "$GITHUB_OUTPUT" fi - name: Run shfmt (diff mode, indent=4, simplify)