-
Notifications
You must be signed in to change notification settings - Fork 8
55 lines (46 loc) · 1.4 KB
/
pre-commit.yml
File metadata and controls
55 lines (46 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Pre-commit
# This workflow runs the same pre-commit hooks as configured in .pre-commit-config.yaml
# IMPORTANT: Keep tool versions synchronized between:
# 1. .pre-commit-config.yaml (rev fields)
# 2. pyproject.toml (dev dependencies)
# 3. This GitHub Actions workflow
#
# Version mapping:
# - pre-commit-hooks: v4.5.0
# - ruff-pre-commit: v0.1.6 -> ruff==0.1.6
# - mirrors-mypy: v1.7.1 -> mypy==1.7.1
# - pyproject.toml dev deps: pytest>=7.4.0, ruff==0.1.6, etc.
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install dependencies
run: |
# Install pre-commit
uv pip install --system pre-commit==3.4.0
- name: Cache pre-commit
uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Run pre-commit
run: |
# Use exact same versions as .pre-commit-config.yaml
pre-commit run --all-files
env:
# Ensure pre-commit uses the specific versions from config
PRE_COMMIT_HOME: ~/.cache/pre-commit