Skip to content

changed a pre-commit.yml file to use modify cache file. #1693

changed a pre-commit.yml file to use modify cache file.

changed a pre-commit.yml file to use modify cache file. #1693

Workflow file for this run

name: Pre-commit QA
on:
pull_request:
push:
branches: [main]
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
# Install pre-commit package
- name: Install pre-commit
run: |
python -m pip install --upgrade pip
pip install pre-commit
# Cache step to reuse pre-commit cache
- name: Cache Pre-commit
uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-pre-commit-${{ github.sha }}
restore-keys: |
${{ runner.os }}-pre-commit-
# Step to initialize pre-commit to set up the cache
- name: Install pre-commit hooks
run: pre-commit install-hooks
# Step to replace 'python_venv' with 'python' in .pre-commit-hooks.yaml
- name: Fix pre-commit hook language
run: |
find ~/.cache/pre-commit/ -type f -name '.pre-commit-hooks.yaml' -exec sed -i 's/python_venv/python/g' {} +
# Run pre-commit action
- name: Run pre-commit checks
uses: pre-commit/[email protected]
with:
all_files: true