Failed builds are being deployed

When we have a bug in our app so build fails, CI job should also fail and do not proceed to deploy, but Cloudflare Pages does not behave like this, so in case of fail it will deploy empty site (404 everywhere).

It is Nuxt 2 site. Preset is configured. Tried both npm run generate and nuxt generate.

How to make CF builds to behave correctly?

Does your generate command exit with a non-zero status code? As long as it exits with an erroring status code (like 1), I believe it should be treated as a failure.