diff --git a/.github/workflows/linters.yaml b/.github/workflows/linters.yaml index c861ef2..c447b19 100644 --- a/.github/workflows/linters.yaml +++ b/.github/workflows/linters.yaml @@ -9,3 +9,39 @@ jobs: mypy: uses: janw/workflows/.github/workflows/poetry-mypy.yaml@main + + pre-commit-local: + runs-on: ubuntu-latest + steps: + - name: Check out + uses: actions/checkout@v3 + with: + token: ${{ secrets.BOT_PERSONAL_ACCESS_TOKEN }} + + - name: Install poetry + run: pipx install poetry + + - name: Set up python environment + uses: actions/setup-python@v5 + with: + cache: poetry + python-version: 3.x + + - name: Install dependencies + run: poetry install --no-root --sync + + - uses: actions/cache@v4 + with: + path: ~/.cache/pre-commit + key: pre-commit-v0|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }} + + - run: poetry run pre-commit run --show-diff-on-failure --color=always --all-files + shell: bash + + - uses: pre-commit-ci/lite-action@v1.0.3 + if: always() + + - uses: stefanzweifel/git-auto-commit-action@v5 + if: always() + with: + commit_message: "build(lint): Auto-fix linting issues" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4f5a25c..5591748 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,6 +11,11 @@ default_install_hook_types: default_stages: - pre-commit repos: + - repo: https://github.com/janw/pre-commit-hooks + rev: v0.1.0 + hooks: + - id: sync_ruff_version + - repo: https://github.com/astral-sh/ruff-pre-commit rev: 'v0.6.8' hooks: @@ -31,6 +36,9 @@ repos: - repo: https://github.com/python-poetry/poetry rev: '1.8.0' hooks: + - id: poetry-lock + args: + - --no-update - id: poetry-check - repo: https://github.com/streetsidesoftware/cspell-cli