Repository navigation
Expand file tree
/
Copy pathlefthook.yml
More file actions
66 lines (57 loc) · 2.36 KB
/
Copy pathlefthook.yml
File metadata and controls
66 lines (57 loc) · 2.36 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
colors: false
output:
- summary
- failure
pre-commit:
# Skip the entire hook in CI — GitHub Actions runs each check independently
# in dedicated workflow steps, making the hook redundant and harmful
# (failed hook = create_pull_request retries with a new branch each time).
skip:
- CI: 'true'
commands:
# --- Block manually committed migration files ----------------------------
no-migrations:
skip:
- CI: 'true'
run: |
if [ "${ALLOW_MIGRATIONS:-}" = "1" ]; then exit 0; fi
migration_files=$(git diff --cached --name-only -- \
'packages/backend/drizzle/migrations/' \
'packages/backend/drizzle/migrations_pg/' || true)
if [ -n "$migration_files" ]; then
echo ""
echo "[pre-commit] ERROR: Migration files should not be committed manually."
echo "Migrations are auto-generated on main by CI after schema changes merge."
echo ""
echo "Blocked files:"
echo "$migration_files" | sed 's/^/ /'
echo ""
echo "To remove them: git reset HEAD -- packages/backend/drizzle/migrations/ packages/backend/drizzle/migrations_pg/"
echo "To bypass (maintainers only): ALLOW_MIGRATIONS=1 git commit ..."
echo ""
exit 1
fi
# --- Validate changed GitHub Actions workflow YAML -----------------------
workflow-yaml:
glob: '.github/workflows/*.{yml,yaml}'
run: mise exec -- actionlint {staged_files}
# --- Format staged files in-place and re-stage --------------------------
# `bun fmt --staged` formats only staged files and re-stages them, which
# replaces both the old biome-format and biome-lint hook commands.
fmt:
run: bun fmt --staged
# --- TypeScript type-check across all packages ---------------------------
typecheck:
run: bun run typecheck
# --- Frontend build (catches broken imports/exports) ---------------------
frontend-build:
glob: 'packages/frontend/src/**'
run: bun run build:frontend
# --- OpenAPI spec lint (only when OpenAPI docs change) -----------------
openapi-lint:
glob: 'docs/openapi/**'
run: bun run lint:openapi
# --- Backend tests (only when backend source changes) --------------------
backend-tests:
glob: 'packages/backend/src/**'
run: bun test --parallel --changed=HEAD