mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-10 09:51:02 +01:00
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
85 lines
2.7 KiB
YAML
85 lines
2.7 KiB
YAML
name: Lint On Change
|
|
|
|
on:
|
|
push:
|
|
branches: [ master ]
|
|
paths-ignore:
|
|
- "**/config.*"
|
|
pull_request:
|
|
branches: [ master ]
|
|
|
|
jobs:
|
|
run-lint:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v5
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set diff range
|
|
id: diff
|
|
run: |
|
|
if [ "${{ github.event_name }}" = "pull_request" ]; then
|
|
echo "DIFF_RANGE=${{ github.event.pull_request.base.sha }}...${{ github.sha }}" >> $GITHUB_ENV
|
|
else
|
|
echo "DIFF_RANGE=${{ github.event.before }}...${{ github.sha }}" >> $GITHUB_ENV
|
|
fi
|
|
|
|
- name: Fix non-printable Unicode spaces in changed text files
|
|
run: |
|
|
echo "Finding changed files in $DIFF_RANGE..."
|
|
CHANGED_FILES=$(git diff --name-only $DIFF_RANGE)
|
|
UNICODE_SPACES_REGEX=$'[\u00A0\u2002\u2003\u2007\u2008\u2009\u202F\u205F\u3000\u200B]'
|
|
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"
|
|
perl -CSD -pe "s/$UNICODE_SPACES_REGEX/ /g" "$file" > "$file.tmp" && mv "$file.tmp" "$file"
|
|
else
|
|
echo "Skipping non-text file: $file ($MIME_TYPE)"
|
|
fi
|
|
fi
|
|
done
|
|
|
|
- name: Run Super Linter
|
|
uses: super-linter/super-linter/slim@main
|
|
continue-on-error: true
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
VALIDATE_ALL_CODEBASE: false
|
|
VALIDATE_CHECKOV: false
|
|
VALIDATE_PYTHON_PYLINT: false
|
|
VALIDATE_JSCPD: false
|
|
VALIDATE_NATURAL_LANGUAGE: false
|
|
FILTER_REGEX_EXCLUDE: .github/workflows/.*
|
|
FIX_ENV: false
|
|
FIX_HTML_PRETTIER: false
|
|
FIX_SHELL_SHFMT: true
|
|
FIX_YAML_PRETTIER: false
|
|
FIX_JSON: false
|
|
#FIX_JSON_PRETTIER: true
|
|
FIX_MARKDOWN: false
|
|
#FIX_MARKDOWN_PRETTIER: true
|
|
FIX_PYTHON_BLACK: false
|
|
FIX_PYTHON_ISORT: false
|
|
FIX_PYTHON_RUFF: false
|
|
|
|
- name: Restore executable permissions
|
|
run: |
|
|
find . -type f \( -name "*.sh" -o -name "run" \) -exec chmod +x {} \;
|
|
|
|
- name: Sort json files
|
|
id: sort
|
|
run: |
|
|
for files in */*.json; do
|
|
echo "Sorting $files"
|
|
jq --sort-keys . "$files" > config2.json && cat config2.json > "$files" && rm config2.json
|
|
echo "changed=1" >> "$GITHUB_OUTPUT"
|
|
done
|
|
shell: bash
|
|
|
|
- name: Remove Super-Linter output (prevent checkout conflict)
|
|
run: sudo rm -rf super-linter-output/
|