-
Notifications
You must be signed in to change notification settings - Fork 24
49 lines (42 loc) · 1.16 KB
/
pre-commit.yml
File metadata and controls
49 lines (42 loc) · 1.16 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
---
name: pre-commit
permissions:
contents: read
on:
push:
branches:
- "master"
pull_request:
jobs:
hooks:
runs-on: ubuntu-latest
steps:
# Get the code
- name: Checkout
uses: actions/checkout@v6
# Set up Python with built-in pip caching
- name: Set up Python
id: python
uses: actions/setup-python@v6
with:
python-version: "3.13"
# Cache pre-commit’s virtual envs + hook repos
- name: Cache pre-commit envs
uses: actions/cache@v5
with:
path: ~/.cache/pre-commit
key: >
${{ format('pre-commit-{0}-{1}',
steps.python.outputs.python-version,
hashFiles('.pre-commit-config.yaml')) }}
# Install the tool itself
- name: Install pre-commit
run: |
pip install --upgrade pip pre-commit
pre-commit install
# Run all hooks not already handled by other workflows
- name: Run hooks
run: |
# Formatting already handled by a dedicated hook
SKIP="ocaml-format" \
pre-commit run --all-files --show-diff-on-failure --color=always