changed a pre-commit.yml file to use modify cache file. #1698
Workflow file for this run
This file contains 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 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 | ||
# Install pre-commit hooks (this will create the necessary cache directories) | ||
- name: Install pre-commit hooks | ||
run: pre-commit install | ||
# Step to fix 'python_venv' language to 'python' in .pre-commit-hooks.yaml | ||
- name: Fix 'python_venv' language to 'python' in .pre-commit-hooks.yaml | ||
run: | | ||
echo "Fixing pre-commit hook language..." | ||
# Modify the cached .pre-commit-hooks.yaml files now that pre-commit hooks are installed | ||
sudo find /home/runner/.cache/pre-commit/ -type f -name '.pre-commit-hooks.yaml' -exec sed -i 's/python_venv/python/g' {} + | ||
# Run pre-commit checks | ||
- name: Run pre-commit checks | ||
uses: pre-commit/[email protected] | ||
with: | ||
extra_args: ["--all-files"] | ||