Skip to content

Update .pre-commit-config.yaml #22

Update .pre-commit-config.yaml

Update .pre-commit-config.yaml #22

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Test
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/[email protected]
- name: Set up Python 3.9
uses: actions/[email protected]
with:
python-version: "3.9"
- name: Install dependencies
run: |
pip install -r requirements_dev.txt -e .
- name: Compute pre-commit cache key
id: pre-commit-cache
shell: python
run: |
import hashlib
import sys
python = "py{}.{}".format(*sys.version_info[:2])
payload = sys.version.encode() + sys.executable.encode()
digest = hashlib.sha256(payload).hexdigest()
result = "${{ runner.os }}-{}-{}-pre-commit".format(python, digest[:8])
print("::set-output name=result::{}".format(result))
- name: Restore pre-commit cache
uses: actions/[email protected]
with:
path: ~/.cache/pre-commit
key: ${{ steps.pre-commit-cache.outputs.result }}-${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
${{ steps.pre-commit-cache.outputs.result }}-
- name: Run pre-commit
run: |
pre-commit run --all-files --show-diff-on-failure