From 8ae28f30ed560340d949149d52a923a7acbfa64b Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Tue, 10 Jun 2025 14:33:39 +0200 Subject: [PATCH] Update onpush_superlinter.yml --- .github/workflows/onpush_superlinter.yml | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/onpush_superlinter.yml b/.github/workflows/onpush_superlinter.yml index a51154f6d..49abc0951 100644 --- a/.github/workflows/onpush_superlinter.yml +++ b/.github/workflows/onpush_superlinter.yml @@ -15,15 +15,29 @@ jobs: with: fetch-depth: 0 - - name: Fix non-breaking spaces + - name: Fix non-breaking spaces in changed text files run: | - echo "Replacing non-breaking spaces (U+00A0) with regular spaces..." - find . -type f -not -path "./.git/*" -exec sed -i 's/\xC2\xA0/ /g' {} + + echo "Finding changed files..." + CHANGED_FILES=$(git diff --name-only origin/master...HEAD) + + echo "Filtering text files..." + for file in $CHANGED_FILES; do + if [ -f "$file" ]; then + MIME_TYPE=$(file --mime-type -b "$file") + if [[ "$MIME_TYPE" == text/* ]]; then + echo "Fixing: $file" + sed -i 's/\xC2\xA0/ /g' "$file" + else + echo "Skipping non-text file: $file ($MIME_TYPE)" + fi + fi + done + if [[ -n "$(git status --porcelain)" ]]; then git config user.name "github-actions" git config user.email "github-actions@github.com" git add . - git commit -m "fix: replace non-breaking spaces with regular spaces" + git commit -m "fix: replace non-breaking spaces in changed text files" git push else echo "No changes to commit."