name: Lint Codebase on: workflow_dispatch: schedule: - cron: "0 0 * * 0" jobs: super-lint: name: Lint and Autofix runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v6 with: fetch-depth: 0 - name: Fix non-printable Unicode spaces in all text files run: | echo "Searching for all files in the repository..." UNICODE_SPACES_REGEX=$'[\u00A0\u2002\u2003\u2007\u2008\u2009\u202F\u205F\u3000\u200B]' # Find all regular files, excluding .git directory find . -type f ! -path "./.git/*" | while read -r file; do 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 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: true VALIDATE_CHECKOV: false VALIDATE_PYTHON_PYLINT: false VALIDATE_JSCPD: false VALIDATE_NATURAL_LANGUAGE: false FILTER_REGEX_EXCLUDE: .github/workflows/.* FIX_ENV: true FIX_HTML_PRETTIER: true FIX_SHELL_SHFMT: true FIX_YAML_PRETTIER: true FIX_JSON: false #FIX_JSON_PRETTIER: true FIX_MARKDOWN: true #FIX_MARKDOWN_PRETTIER: true FIX_PYTHON_BLACK: true FIX_PYTHON_ISORT: true FIX_PYTHON_RUFF: true - name: Use 4 spaces in shell scripts run: | curl -sSLo /usr/local/bin/shfmt https://github.com/mvdan/sh/releases/download/v3.12.0/shfmt_v3.12.0_linux_amd64 chmod +x /usr/local/bin/shfmt find . -type f \( -name "*.sh" -o -name "run" \) -exec shfmt -w -i 4 -ci -bn -sr {} + - 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: Restore executable permissions run: | find . -type f \( -name "*.sh" -o -name "run" \) -exec chmod +x {} \; - name: Remove Super-Linter output (prevent checkout conflict) run: sudo rm -rf super-linter-output/ - name: Check for linting changes id: changed run: | if ! git diff --quiet; then echo "changed=true" >> "$GITHUB_OUTPUT" else echo "changed=false" >> "$GITHUB_OUTPUT" fi - name: Create New Pull Request If Needed if: steps.changed.outputs.changed == 'true' uses: peter-evans/create-pull-request@v7 with: title: "Github bot: fix linting issues nobuild" commit-message: "fix: auto-fix linting issues" branch-suffix: timestamp