Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,35 @@
name: pre-commit

permissions:
contents: read

on: [pull_request]

jobs:
pre-commit:
name: Run pre-commit # https://pre-commit.com/
name: Run pre-commit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5 # https://www.python.org/
- name: Checkout Code
uses: actions/checkout@v6
with:
# Fetch all history so pre-commit can compare if needed
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.x" # Version range or exact version of a Python version to use, using SemVer's version range syntax
python-version: "3.x"
architecture: "x64" # optional x64 or x86. Defaults to x64 if not specified
- name: Install dependencies # https://pip.pypa.io/en/stable/
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pre-commit
- name: Set PY
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- uses: actions/cache@v3
- name: Cache Pre-commit Hooks
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Run pre-commit
run: pre-commit run --all-files
- name: Run pre-commit hooks
run: pre-commit run --all-files --show-diff-on-failure --color always