File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,3 +59,33 @@ if echo "$changed" | grep -qE "Dockerfile$"; then
5959 echo "$changed" | grep -E "Dockerfile$" | xargs hadolint || exit 1
6060fi
6161'''
62+
63+ [tasks ."git:pre-push" ]
64+ description = " Validate branch name and run tests before push"
65+ run = '''
66+ #!/usr/bin/env bash
67+ pnpm dlx @gracefullight/validate-branch || exit 1
68+
69+ # Get changed files compared to origin
70+ changed=$(git diff --name-only origin/main...HEAD 2>/dev/null || git diff --name-only HEAD~1)
71+
72+ if echo "$changed" | grep -q "^apps/api/"; then
73+ echo "[pre-push] apps/api detected, running test..."
74+ mise //apps/api:test || exit 1
75+ fi
76+
77+ if echo "$changed" | grep -q "^apps/web/"; then
78+ echo "[pre-push] apps/web detected, running test..."
79+ mise //apps/web:test || exit 1
80+ fi
81+
82+ if echo "$changed" | grep -q "^apps/worker/"; then
83+ echo "[pre-push] apps/worker detected, running test..."
84+ mise //apps/worker:test || exit 1
85+ fi
86+
87+ if echo "$changed" | grep -q "^apps/mobile/"; then
88+ echo "[pre-push] apps/mobile detected, running test..."
89+ mise //apps/mobile:test || exit 1
90+ fi
91+ '''
You can’t perform that action at this time.
0 commit comments