Repository navigation
Expand file tree
/
Copy pathlefthook.yml
More file actions
52 lines (48 loc) · 2.1 KB
/
Copy pathlefthook.yml
File metadata and controls
52 lines (48 loc) · 2.1 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
output:
- summary
- success
- failure
- execution
post-checkout:
commands:
build:
run: |
go build -o ./cli-printing-press ./cmd/cli-printing-press 2>/dev/null && echo "cli-printing-press binary rebuilt" || true
[ -x "$HOME/go/bin/cli-printing-press" ] && go install ./cmd/cli-printing-press 2>/dev/null && echo "cli-printing-press go install synced" || true
post-merge:
commands:
build:
run: |
go build -o ./cli-printing-press ./cmd/cli-printing-press 2>/dev/null && echo "cli-printing-press binary rebuilt" || true
[ -x "$HOME/go/bin/cli-printing-press" ] && go install ./cmd/cli-printing-press 2>/dev/null && echo "cli-printing-press go install synced" || true
pre-commit:
commands:
fmt:
glob: "*.go"
run: |
files="$(printf '%s\n' {staged_files} | grep -v '^testdata/golden/expected/' || true)"
test -z "$files" || { printf '%s\n' "$files" | xargs gofmt -w; printf '%s\n' "$files" | xargs git add; }
stage_fixed: true
sync-verify-skill:
# Keep internal/cli/verify_skill_bundled.py byte-identical to the
# canonical scripts/verify-skill/verify_skill.py so the binary's
# `verify-skill` runs the same checks as the library repo's CI. The
# Go test TestVerifySkillScriptInSync is the safety net for commits
# that bypass lefthook (--no-verify); this hook is the auto-fix path.
glob: "scripts/verify-skill/verify_skill.py"
run: |
cp scripts/verify-skill/verify_skill.py internal/cli/verify_skill_bundled.py
git add internal/cli/verify_skill_bundled.py
stage_fixed: true
pre-push:
commands:
fmt:
glob: "*.go"
run: |
unformatted="$(git ls-files '*.go' ':!:testdata/golden/expected/**' | xargs gofmt -l)"
test -z "$unformatted" || { printf '%s\n' "$unformatted"; exit 1; }
fail_text: "gofmt failed. Run 'go fmt ./...' to fix. Do not run 'gofmt -w .' from the repo root; it can rewrite golden fixtures."
lint:
glob: "*.go"
run: golangci-lint run ./...
fail_text: "golangci-lint failed. Fix lint errors before pushing."