-
Notifications
You must be signed in to change notification settings - Fork 22
46 lines (37 loc) · 1.23 KB
/
pre-commit.yml
File metadata and controls
46 lines (37 loc) · 1.23 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
name: pre-commit
# Runs the pre-commit-stage hooks defined in .pre-commit-config.yaml as a
# CI safety net for contributors who skip local hooks. File-hygiene checks
# (trailing whitespace, EOF, yaml, large files, merge conflicts) and ruff
# format/lint live here. The verify loop (basedpyright, import-linter,
# pytest --cov) runs in verify.yml; the two workflows are orthogonal.
on:
pull_request:
branches: [master]
push:
branches: [master]
workflow_dispatch:
concurrency:
group: pre-commit-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
pre-commit:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Cache pre-commit
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Install pre-commit
run: |
python -m pip install --upgrade pip
pip install pre-commit
- name: Run pre-commit hooks (commit stage)
run: pre-commit run --all-files --hook-stage pre-commit