fix(ci): install frontend deps before prettier hook
All checks were successful
CICD Start / Sanity and Base Decision (pull_request) Successful in 24s
All checks were successful
CICD Start / Sanity and Base Decision (pull_request) Successful in 24s
This commit is contained in:
@@ -230,9 +230,12 @@ jobs:
|
||||
echo "=== Host Workspace Debug (prettier) ==="
|
||||
echo "host_head_sha=${HEAD_SHA}"
|
||||
git rev-parse --short HEAD || true
|
||||
cd frontend && corepack yarn prettier --version && corepack yarn prettier --check src/main.test.ts src/main.ts src/test-setup.ts src/validation.test.ts src/validation.ts || true
|
||||
sha256sum src/main.test.ts src/main.ts src/test-setup.ts src/validation.test.ts src/validation.ts || true
|
||||
cd ..
|
||||
if [ -d frontend ]; then
|
||||
(cd frontend && corepack yarn prettier --version && corepack yarn prettier --check src/main.test.ts src/main.ts src/test-setup.ts src/validation.test.ts src/validation.ts) || true
|
||||
(cd frontend && sha256sum src/main.test.ts src/main.ts src/test-setup.ts src/validation.test.ts src/validation.ts) || true
|
||||
else
|
||||
echo "host_frontend_dir_missing=frontend"
|
||||
fi
|
||||
fi
|
||||
|
||||
LOG_FILE="$(mktemp)"
|
||||
@@ -255,35 +258,36 @@ jobs:
|
||||
fi &&
|
||||
case "${HOOK}" in
|
||||
eslint|prettier|tsdoc-lint|typescript-check)
|
||||
echo 'JS hook detected; ensuring frontend yarn install state exists' &&
|
||||
echo 'JS hook detected; preparing frontend dependencies' &&
|
||||
if [ ! -d /workspace/frontend ]; then
|
||||
echo '❌ Missing /workspace/frontend for JS hook execution' &&
|
||||
exit 1
|
||||
fi &&
|
||||
cd /workspace/frontend &&
|
||||
install_ok=false &&
|
||||
for i in 1 2 3; do
|
||||
echo 'yarn install attempt' "\$i"'/3' &&
|
||||
if timeout 1200 corepack yarn install --immutable --mode=skip-build; then
|
||||
install_ok=true
|
||||
break
|
||||
fi
|
||||
if [ "\$i" -lt 3 ]; then
|
||||
echo 'yarn install failed; cleaning and retrying in 20s' &&
|
||||
rm -rf node_modules .yarn/install-state.gz .yarn/cache &&
|
||||
corepack yarn cache clean --all 2>/dev/null || true &&
|
||||
sleep 20
|
||||
fi
|
||||
done &&
|
||||
if [ "\$install_ok" != 'true' ]; then
|
||||
echo '❌ Unable to prepare frontend dependencies for JS pre-commit hooks' &&
|
||||
exit 1
|
||||
fi &&
|
||||
if [ "${HOOK}" = "prettier" ]; then
|
||||
echo '=== Container Workspace Debug (prettier) ===' &&
|
||||
corepack yarn prettier --version &&
|
||||
corepack yarn prettier --version || true &&
|
||||
sha256sum src/main.test.ts src/main.ts src/test-setup.ts src/validation.test.ts src/validation.ts || true &&
|
||||
corepack yarn prettier --check src/main.test.ts src/main.ts src/test-setup.ts src/validation.test.ts src/validation.ts || true
|
||||
fi &&
|
||||
if [ ! -f '.yarn/install-state.gz' ]; then
|
||||
echo 'Missing .yarn/install-state.gz; running yarn install' &&
|
||||
install_ok=false &&
|
||||
for i in 1 2 3; do
|
||||
echo 'yarn install attempt' "\$i"'/3' &&
|
||||
if timeout 1200 corepack yarn install --immutable --mode=skip-build; then
|
||||
install_ok=true
|
||||
break
|
||||
fi
|
||||
if [ "\$i" -lt 3 ]; then
|
||||
echo 'yarn install failed; cleaning and retrying in 20s' &&
|
||||
rm -rf node_modules .yarn/install-state.gz .yarn/cache &&
|
||||
corepack yarn cache clean --all 2>/dev/null || true &&
|
||||
sleep 20
|
||||
fi
|
||||
done &&
|
||||
if [ "\$install_ok" != 'true' ]; then
|
||||
echo '❌ Unable to prepare frontend dependencies for JS pre-commit hooks' &&
|
||||
exit 1
|
||||
fi
|
||||
fi &&
|
||||
cd /workspace
|
||||
;;
|
||||
esac &&
|
||||
|
||||
Reference in New Issue
Block a user