mirror of
https://github.com/karpathy/nanochat.git
synced 2025-12-06 04:12:13 +00:00
Sets up a pre-commit workflow to automate code linting and formatting. This ensures code quality and consistency by running checks before code is committed.
45 lines
915 B
YAML
45 lines
915 B
YAML
name: Pre-commit
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- "release/**"
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
run-pre-commit:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.10"
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v7
|
|
|
|
- name: Cache uv & pre-commit
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
.venv
|
|
~/.cache/uv
|
|
~/.cache/pre-commit
|
|
key: ${{ runner.os }}-uv-${{ hashFiles('uv.lock', '.pre-commit-config.yaml') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-uv-
|
|
|
|
- name: Install dev dependencies
|
|
run: uv sync --group dev
|
|
|
|
- name: Run pre-commit
|
|
run: uv run pre-commit run --all-files
|