1# Licensed to the Apache Software Foundation (ASF) under one 2# or more contributor license agreements. See the NOTICE file 3# distributed with this work for additional information 4# regarding copyright ownership. The ASF licenses this file 5# to you under the Apache License, Version 2.0 (the 6# "License"); you may not use this file except in compliance 7# with the License. You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, 12# software distributed under the License is distributed on an 13# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14# KIND, either express or implied. See the License for the 15# specific language governing permissions and limitations 16# under the License. 17 18name: pre-commit 19 20on: [pull_request] 21 22permissions: 23 contents: read 24 25concurrency: 26 group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} 27 cancel-in-progress: true 28 29jobs: 30 pre-commit: 31 name: Run pre-commit 32 runs-on: ubuntu-24.04 33 steps: 34 - name: Check Out 35 uses: actions/checkout@v6 36 - name: Install 37 run: | 38 python -m pip install --upgrade pip 39 pip install -r requirements-dev.txt 40 - name: Set PY 41 run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV 42 - uses: actions/cache@v5 43 with: 44 path: ~/.cache/pre-commit 45 key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} 46 - name: Run pre-commit 47 run: pre-commit run --color=always --all-files 48