# @file precommit-check.yml # @kaspersky_support Artiom N. # @license Apache 2.0 # @copyright © 2025 AO Kaspersky Lab # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. name: Run pre-commit checks on: [push, pull_request] permissions: contents: read jobs: pre-commit: timeout-minutes: 10 runs-on: ubuntu-24.04 container: image: kasperskydh/knp-build-image volumes: - ${{ github.workspace }}:/KNP options: --cpus 1 steps: - name: Set git options run: git config --global --add safe.directory "*" shell: bash - uses: actions/checkout@v3 - id: changed_files uses: trilom/file-changes-action@v1.2.4 with: output: ' ' - run: ln -s /usr/bin/python3 /usr/bin/python shell: bash - run: mkdir -p ~/.config/pip/ && echo -e "[global]\nbreak-system-packages = true" > ~/.config/pip/pip.conf shell: bash - run: git config --global --add safe.directory /KNP shell: bash - name: Run pre-commit run: pre-commit run --show-diff-on-failure --color=always --files ${{ steps.changed_files.outputs.files}} || cat /github/home/.cache/pre-commit/pre-commit.log working-directory: /KNP shell: bash