Introduce AsyncURIMatcher class to encapsulate the URI matching logic with and without regex support (-D ASYNCWEBSERVER_REGEX=1) #777
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Pre-commit hooks | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| types: [opened, reopened, synchronize, labeled] | |
| concurrency: | |
| group: pre-commit-${{github.event.pull_request.number || github.ref}} | |
| cancel-in-progress: true | |
| jobs: | |
| lint: | |
| if: | | |
| github.event_name != 'pull_request' || | |
| contains(github.event.pull_request.labels.*.name, 'Status: Pending Merge') || | |
| contains(github.event.pull_request.labels.*.name, 'Re-trigger Pre-commit') | |
| name: Check if fixes are needed | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout latest commit | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 2 | |
| - name: Remove Label | |
| if: contains(github.event.pull_request.labels.*.name, 'Re-trigger Pre-commit') | |
| run: gh pr edit ${{ github.event.number }} --remove-label 'Re-trigger Pre-commit' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| - name: Set up Python 3 | |
| uses: actions/setup-python@v6 | |
| with: | |
| cache-dependency-path: pre-commit.requirements.txt | |
| cache: "pip" | |
| python-version: "3.x" | |
| - name: Get Python version hash | |
| run: | | |
| echo "Using $(python -VV)" | |
| echo "PY_HASH=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV | |
| - name: Restore pre-commit cache | |
| uses: actions/cache/restore@v4 | |
| id: restore-cache | |
| with: | |
| path: | | |
| ~/.cache/pre-commit | |
| key: pre-commit-${{ env.PY_HASH }}-${{ hashFiles('.pre-commit-config.yaml', '.github/workflows/pre-commit.yml', 'pre-commit.requirements.txt') }} | |
| - name: Install python dependencies | |
| run: python -m pip install -r pre-commit.requirements.txt | |
| - name: Get changed files | |
| id: changed-files | |
| uses: tj-actions/changed-files@v42.0.2 | |
| - name: Run pre-commit hooks in changed files | |
| run: pre-commit run --color=always --show-diff-on-failure --files ${{ steps.changed-files.outputs.all_changed_files }} | |
| - name: Save pre-commit cache | |
| uses: actions/cache/save@v4 | |
| if: ${{ always() && steps.restore-cache.outputs.cache-hit != 'true' }} | |
| continue-on-error: true | |
| with: | |
| path: | | |
| ~/.cache/pre-commit | |
| key: ${{ steps.restore-cache.outputs.cache-primary-key }} | |
| - name: Push changes using pre-commit-ci-lite | |
| uses: pre-commit-ci/lite-action@v1.1.0 | |
| # Only push changes in PRs | |
| if: ${{ always() && github.event_name == 'pull_request' }} | |
| with: | |
| msg: "ci(pre-commit): Apply automatic fixes" |