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 Workspace Debug (prettier) ==="
|
||||||
echo "host_head_sha=${HEAD_SHA}"
|
echo "host_head_sha=${HEAD_SHA}"
|
||||||
git rev-parse --short HEAD || true
|
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
|
if [ -d frontend ]; then
|
||||||
sha256sum src/main.test.ts src/main.ts src/test-setup.ts src/validation.test.ts src/validation.ts || 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
|
||||||
cd ..
|
(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
|
fi
|
||||||
|
|
||||||
LOG_FILE="$(mktemp)"
|
LOG_FILE="$(mktemp)"
|
||||||
@@ -255,35 +258,36 @@ jobs:
|
|||||||
fi &&
|
fi &&
|
||||||
case "${HOOK}" in
|
case "${HOOK}" in
|
||||||
eslint|prettier|tsdoc-lint|typescript-check)
|
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 &&
|
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
|
if [ "${HOOK}" = "prettier" ]; then
|
||||||
echo '=== Container Workspace Debug (prettier) ===' &&
|
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 &&
|
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
|
corepack yarn prettier --check src/main.test.ts src/main.ts src/test-setup.ts src/validation.test.ts src/validation.ts || true
|
||||||
fi &&
|
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
|
cd /workspace
|
||||||
;;
|
;;
|
||||||
esac &&
|
esac &&
|
||||||
|
|||||||
Reference in New Issue
Block a user