Skip to content

Commit

Permalink
minor change
Browse files Browse the repository at this point in the history
  • Loading branch information
nkhadka21 committed Nov 12, 2024
1 parent 55efbac commit 2a39d82
Showing 1 changed file with 7 additions and 19 deletions.
26 changes: 7 additions & 19 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,17 @@ jobs:
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-
# Remove pre-existing cache to avoid issues
- name: Clear pre-commit cache
run: rm -rf ~/.cache/pre-commit

# Install pre-commit hooks (this will create necessary cache files)
- name: Install pre-commit hooks
run: pre-commit install

# Step to replace 'python_venv' with 'python' in .pre-commit-hooks.yaml
- name: Fix pre-commit hook language
# 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 before installation
find ~/.cache/pre-commit/ -type f -name '.pre-commit-hooks.yaml' -exec sed -i 's/python_venv/python/g' {} +
# Install pre-commit hooks after fixing language key
- name: Install pre-commit hooks
run: pre-commit install

# Run pre-commit action
- name: Run pre-commit checks
uses: pre-commit/[email protected]
Expand Down

0 comments on commit 2a39d82

Please sign in to comment.