why is · unni-web
Why is my Pages build running for every site?
Symptom
A monorepo has one Pages project per site. A commit that only touches
_packets/ (documentation) still triggered a production build of every
connected project.
Cause
Cloudflare’s native GitHub integration builds each connected project on every
push to its production branch. The path_includes watch paths configured on
the project did not prevent production builds in our test. They are honoured
for preview deployments.
Explanation
Each project has its own root directory (sites/<name>), so each build only
compiles its own site. Nothing is wrong with the output; it is simply not
selective. For small static sites the cost is a few seconds per project and
stays inside the free tier.
Fix link
If selective production deploys matter, use GitHub Actions with path filters and a Direct Uploads deployment instead of the native integration:
- Workflow
paths:filters onsites/<name>/**. cloudflare/wrangler-actionwith a Pages:Edit API token.- Trade-off: one more secret to manage.
See: How to: deploy the Unni sites.
Related
- How to: deploy the Unni sites
- How does the Unni shared builder work?