How do you structure a mono-repo CI/CD pipeline to avoid unnecessary builds?
In a monorepo with 20+ services, you must only trigger builds for services that actually changed. Strategies:
- Path filters: GitHub Actions
paths:filter to trigger workflows only when specific directories change. - Nx / Turborepo: Task runners with build graph awareness that skip unchanged services.
- git diff: Compare changed files against the base branch and only build affected services.
# GitHub Actions path filter
on:
push:
paths:
- "services/api/**"
- "shared/lib/**"