-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlefthook.yml
More file actions
70 lines (62 loc) · 2.08 KB
/
lefthook.yml
File metadata and controls
70 lines (62 loc) · 2.08 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
pre-commit:
parallel: true
commands:
go-fmt:
glob: "*.go"
run: test -z "$(gofmt -l . | grep -v vendor)" || (gofmt -d . && exit 1)
go-vet:
glob: "*.go"
run: go vet ./...
go-test:
glob: "*.go"
run: go test ./...
dprint:
glob: "*.{md,json,toml,yml,yaml}"
run: dprint check
workflow-lint:
glob: ".github/workflows/*.{yml,yaml}"
run: |
if command -v ghalint &> /dev/null; then
ghalint run -c tools/lint/ghalint.yaml
fi
# actionlint runs shellcheck on embedded scripts automatically when installed
if command -v actionlint &> /dev/null; then
actionlint {staged_files}
else
echo "Warning: actionlint not installed. Install with: brew install actionlint shellcheck"
fi
fail_text: "Workflow lint failed. Install: brew install actionlint shellcheck"
workflow-pin:
glob: ".github/workflows/*.{yml,yaml}"
run: |
if command -v pinact &> /dev/null; then
pinact run --verify -c tools/lint/pinact.yaml
fi
fail_text: "Run 'pinact run -u -c tools/lint/pinact.yaml' to pin action versions"
commit-msg:
commands:
semantic-commit:
run: |
commit_msg=$(cat {1})
pattern="^(feat|fix|docs|chore|refactor|test|ci|perf|style|build)(\(.+\))?: .+"
if ! echo "$commit_msg" | grep -qE "$pattern"; then
echo "ERROR: Commit message does not follow semantic commit format"
echo ""
echo "Expected format: <type>(<scope>): <description>"
echo ""
echo "Types: feat, fix, docs, chore, refactor, test, ci, perf, style, build"
echo ""
echo "Examples:"
echo " feat: add user authentication"
echo " fix(parser): handle empty input"
echo " docs: update README"
echo ""
echo "Your message: $commit_msg"
exit 1
fi
pre-push:
commands:
go-build:
run: go build ./...
lint:
run: go tool -modfile=tools.go.mod golangci-lint run --config=tools/lint/golangci.toml