-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathlefthook.yml
More file actions
72 lines (63 loc) · 2.38 KB
/
Copy pathlefthook.yml
File metadata and controls
72 lines (63 loc) · 2.38 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# https://lefthook.dev/configuration/
# Full list of hooks: https://git-scm.com/docs/githooks
# debug hooks with:
# LEFTHOOK_VERBOSE=1 lefthook run pre-push --force
output:
- failure
prepare-commit-msg:
commands:
aiautocommit:
interactive: true
run: aiautocommit commit --output-file "{1}"
env:
# without this, lefthook will run in an infinite loop
# LEFTHOOK: "0"
# ensures that LOG_LEVEL config of the current project does not interfere with aiautocommit
LOG_LEVEL: info
skip:
- merge
- rebase
# works by asking Git directly for the location of its internal "sequencer" state, which modern Git uses for rebases, cherry-picks, and reverts.
- run: 'test -d "$(git rev-parse --git-path sequencer)"'
# only run this if the tool exists
- run: "! which aiautocommit"
# Use this to validate commit messages
commit-msg:
commands:
commitlint:
run: commitlint
skip:
# only run this if the tool exists, it's conditionally installed
# https://keisukeyamashita.github.io/commitlint-rs/
- run: "! which commitlint > /dev/null"
# {push_files} are just the files that are going to be pushed, not all files unique to this branch that would be pushed if the push was fresh
# this means that if someone just enables lefthook, or if the linter
pre-push:
parallel: true
commands:
py_lint:
run: just py_lint
js_lint:
run: just js_lint
# post-merge: fires after git merge / git pull
# post-rewrite: fires after git rebase / git commit --amend
# Both detect dependency changes and warn; the hook name provides the context.
.dependency_detection: &dependency_detection
files: "git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD"
commands:
detect_migrations:
glob: "migrations/versions/*"
run: printf '\033[31mmigration files changed, run just db_migrate\033[0m\n'
detect_uv_lock:
glob: "uv.lock"
run: printf '\033[31muv.lock changed, run just py_setup\033[0m\n'
detect_pnpm_lock:
glob: "web/pnpm-lock.yaml"
run: printf '\033[31mpnpm-lock.yaml changed, run just js_setup\033[0m\n'
detect_mise:
glob: "{.config/**,web/mise.toml,infra/mise.toml}"
run: printf '\033[31mmise config changed, run mise install\033[0m\n'
post-merge:
<<: *dependency_detection
post-rewrite:
<<: *dependency_detection