mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-07-29 01:10:32 +02:00
Update onpush_superlinter.yml
This commit is contained in:
33
.github/workflows/onpush_superlinter.yml
vendored
33
.github/workflows/onpush_superlinter.yml
vendored
@@ -15,51 +15,26 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Fix non-breaking spaces in changed text files
|
- name: Fix non-printable Unicode spaces in changed text files
|
||||||
run: |
|
run: |
|
||||||
echo "Finding changed files..."
|
echo "Finding changed files..."
|
||||||
CHANGED_FILES=$(git diff --name-only origin/master...HEAD)
|
CHANGED_FILES=$(git diff --name-only origin/master...HEAD)
|
||||||
|
|
||||||
echo "Filtering text files..."
|
# Unicode blanks regex (covers all mentioned codepoints)
|
||||||
|
UNICODE_SPACES_REGEX=$'[\u00A0\u2002\u2003\u2007\u2008\u2009\u202F\u205F\u3000\u200B]'
|
||||||
# Define fake Unicode blanks to normalize
|
|
||||||
declare -a UNICODE_SPACES=(
|
|
||||||
$'\xC2\xA0' # U+00A0 NBSP
|
|
||||||
$'\xE2\x80\x82' # U+2002 EN SPACE
|
|
||||||
$'\xE2\x80\x83' # U+2003 EM SPACE
|
|
||||||
$'\xE2\x80\x87' # U+2007 FIGURE SPACE
|
|
||||||
$'\xE2\x80\x88' # U+2008 PUNCTUATION SPACE
|
|
||||||
$'\xE2\x80\x89' # U+2009 THIN SPACE
|
|
||||||
$'\xE2\x80\xAF' # U+202F NARROW NBSP
|
|
||||||
$'\xE2\x81\x9F' # U+205F MEDIUM MATH SPACE
|
|
||||||
$'\xE3\x80\x80' # U+3000 IDEOGRAPHIC SPACE
|
|
||||||
$'\xE2\x80\x8B' # U+200B ZERO-WIDTH SPACE
|
|
||||||
)
|
|
||||||
|
|
||||||
for file in $CHANGED_FILES; do
|
for file in $CHANGED_FILES; do
|
||||||
if [ -f "$file" ]; then
|
if [ -f "$file" ]; then
|
||||||
MIME_TYPE=$(file --mime-type -b "$file")
|
MIME_TYPE=$(file --mime-type -b "$file")
|
||||||
if [[ "$MIME_TYPE" == text/* ]]; then
|
if [[ "$MIME_TYPE" == text/* ]]; then
|
||||||
echo "Fixing: $file"
|
echo "Fixing: $file"
|
||||||
for blank in "${UNICODE_SPACES[@]}"; do
|
perl -CSD -pe "s/$UNICODE_SPACES_REGEX/ /g" "$file" > "$file.tmp" && mv "$file.tmp" "$file"
|
||||||
sed -i "s/$blank/ /g" "$file"
|
|
||||||
done
|
|
||||||
else
|
else
|
||||||
echo "Skipping non-text file: $file ($MIME_TYPE)"
|
echo "Skipping non-text file: $file ($MIME_TYPE)"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
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 in changed text files"
|
|
||||||
git push
|
|
||||||
else
|
|
||||||
echo "No changes to commit."
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Run Super Linter
|
- name: Run Super Linter
|
||||||
uses: super-linter/super-linter/slim@main
|
uses: super-linter/super-linter/slim@main
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
|||||||
Reference in New Issue
Block a user