Skip to content

Add pre-commit configuration with ruff, pyright, and other helpful hooks #1

Add pre-commit configuration with ruff, pyright, and other helpful hooks

Add pre-commit configuration with ruff, pyright, and other helpful hooks #1

Workflow file for this run

name: Pre-commit Checks
on:
# Allow manual trigger
workflow_dispatch:
# Run on push to main branch
push:
branches:
- main
# Run on pull requests to main branch
pull_request:
branches:
- main
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Install prek
run: |
uv tool install prek
- name: Cache pre-commit hooks
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
pre-commit-
- name: Run pre-commit with prek
run: |
uv tool run prek run --all-files
- name: Upload pre-commit results
if: always()
uses: actions/upload-artifact@v4
with:
name: pre-commit-results
path: |
.pre-commit.log
if-no-files-found: ignore