diff --git a/.github/mergify.yml b/.github/mergify.yml index 9e49c1167..318e465c7 100644 --- a/.github/mergify.yml +++ b/.github/mergify.yml @@ -170,18 +170,18 @@ pull_request_rules: - name: comment on pre-commit failure conditions: - - check-failure=pre-commit + - check-failure~=pre-commit - -closed actions: comment: message: | ## Pre-commit checks failed - Your PR has formatting or linting issues. To fix them locally: + Hi @{{author}}, the pre-commit checks have failed. To fix them locally: ```bash # Install pre-commit if you haven't already - pip install pre-commit + uv pip install pre-commit pre-commit install # Run all checks and auto-fix what's possible @@ -195,6 +195,8 @@ pull_request_rules: After fixing, commit and push the changes. The checks will re-run automatically. + For future commits, `pre-commit` will run automatically on changed files before each commit. + # ============================================================ # Merge conflict detection # ============================================================ diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index 09cf963b9..585978e8f 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -67,12 +67,8 @@ concurrency: cancel-in-progress: true jobs: - pre-commit: - uses: ./.github/workflows/pre-commit.yml - change-filter: runs-on: ubuntu-latest - needs: pre-commit if: ${{ github.event.pull_request.draft == false || github.event_name == 'workflow_dispatch' }} outputs: encoder-test: ${{ steps.filter.outputs.encoder-test }} diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 6db44912d..6ba2d01d6 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -1,7 +1,18 @@ name: pre-commit on: - workflow_call: + pull_request: + branches: [main] + push: + branches: [main] + workflow_call: + +concurrency: + group: pre-commit-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +permissions: + contents: read jobs: pre-commit: @@ -15,4 +26,4 @@ jobs: - run: echo "::add-matcher::.github/workflows/matchers/mypy.json" - uses: pre-commit/action@v3.0.1 with: - extra_args: --all-files --hook-stage manual \ No newline at end of file + extra_args: --all-files --hook-stage manual