ci: fail the gate when astro build logs an error
`astro build` exits 0 on a vite asset-resolution failure. That is how a stale `@import` survived the cutover and stayed green through every gate run: the build printed `[ERROR]`, returned 0, and the gate believed it. Tee the build log and treat a logged error as a failure. Negative-tested by reintroducing the import -- GATE 1, with both the vite error and the new message. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+14
-1
@@ -43,7 +43,20 @@ step "types"
|
||||
pnpm exec astro check
|
||||
|
||||
step "build"
|
||||
pnpm run build
|
||||
# `astro build` exits 0 even when vite fails to resolve an asset: the cutover
|
||||
# left a stale `@import` in a moved stylesheet and every gate stayed green for
|
||||
# it. Treat a logged error as a failed build.
|
||||
build_log=$(mktemp)
|
||||
if ! pnpm run build 2>&1 | tee "$build_log"; then
|
||||
rm -f "$build_log"
|
||||
exit 1
|
||||
fi
|
||||
if grep -q '\[ERROR\]' "$build_log"; then
|
||||
echo "gate: astro build logged an error and still exited 0. See above." >&2
|
||||
rm -f "$build_log"
|
||||
exit 1
|
||||
fi
|
||||
rm -f "$build_log"
|
||||
|
||||
step "content contracts"
|
||||
pnpm run verify
|
||||
|
||||
Reference in New Issue
Block a user