From 5cf398b72a2499969db4c378c44bca2cef44d0b2 Mon Sep 17 00:00:00 2001 From: Sekwah Date: Mon, 17 Jun 2024 00:16:47 +0100 Subject: [PATCH] chore: add a fix for the terrible default autocrlf setting git does --- .gitattributes | 4 +- .github/workflows/pre-commit-check.yaml | 100 ++++++++++++------------ 2 files changed, 52 insertions(+), 52 deletions(-) diff --git a/.gitattributes b/.gitattributes index 49e55ad0..ad844398 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,2 @@ -# Set default behaviour to maintain line endings -* -text \ No newline at end of file +# Set default behaviour to maintain line endings +* -text diff --git a/.github/workflows/pre-commit-check.yaml b/.github/workflows/pre-commit-check.yaml index 98bab02b..dd588b06 100644 --- a/.github/workflows/pre-commit-check.yaml +++ b/.github/workflows/pre-commit-check.yaml @@ -1,50 +1,50 @@ -name: Pre-commit consistency check - -on: - workflow_dispatch: - pull_request: - types: [labeled, opened, reopened, synchronize] - push: - branches: [spigot, re-recode] - -concurrency: - group: ${{ github.head_ref }}-precommit - cancel-in-progress: true - -jobs: - pre-commit-check: - if: "github.event.action != 'labeled' || github.event.label.name == 'pre-commit ci run'" - name: Run pre-commit checks - runs-on: ubuntu-20.04 - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - run: gh pr edit ${{ github.event.number }} --remove-label 'pre-commit ci run' - if: github.event.action == 'labeled' && github.event.label.name == 'pre-commit ci run' - env: - GH_TOKEN: ${{ github.token }} - - uses: dorny/paths-filter@v2 - id: filter - with: - list-files: shell - filters: | - addedOrModified: - - added|modified: '**' - - # run only if changed files were detected - - name: Run against changes - uses: pre-commit/action@v3.0.1 - if: steps.filter.outputs.addedOrModified == 'true' - with: - extra_args: --files ${{ steps.filter.outputs.addedOrModified_files }} - - # run if no changed files were detected (e.g. workflow_dispatch on master branch) - - name: Run against all files - uses: pre-commit/action@v2.0.3 - if: steps.filter.outputs.addedOrModified != 'true' - with: - extra_args: --all-files - - uses: pre-commit-ci/lite-action@v1.0.2 - if: always() \ No newline at end of file +name: Pre-commit consistency check + +on: + workflow_dispatch: + pull_request: + types: [labeled, opened, reopened, synchronize] + push: + branches: [spigot, re-recode] + +concurrency: + group: ${{ github.head_ref }}-precommit + cancel-in-progress: true + +jobs: + pre-commit-check: + if: github.event.action != 'labeled' || github.event.label.name == 'pre-commit ci run' + name: Run pre-commit checks + runs-on: ubuntu-20.04 + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - run: gh pr edit ${{ github.event.number }} --remove-label 'pre-commit ci run' + if: github.event.action == 'labeled' && github.event.label.name == 'pre-commit ci run' + env: + GH_TOKEN: ${{ github.token }} + - uses: dorny/paths-filter@v2 + id: filter + with: + list-files: shell + filters: | + addedOrModified: + - added|modified: '**' + + # run only if changed files were detected + - name: Run against changes + uses: pre-commit/action@v3.0.1 + if: steps.filter.outputs.addedOrModified == 'true' + with: + extra_args: --files ${{ steps.filter.outputs.addedOrModified_files }} + + # run if no changed files were detected (e.g. workflow_dispatch on master branch) + - name: Run against all files + uses: pre-commit/action@v2.0.3 + if: steps.filter.outputs.addedOrModified != 'true' + with: + extra_args: --all-files + - uses: pre-commit-ci/lite-action@v1.0.2 + if: always()