{"id":"5db64726-5c3c-48da-b699-f44301f4b725","task":"Build an affected-only CI pipeline for a Turbo or Nx monorepo with change detection","domain":"nx.dev","steps":["For Nx, determine the base SHA by finding the last successful CI commit on the main branch; many CI providers expose this via an environment variable, or use the nrwl/nx-set-shas action on GitHub Actions to set NX_BASE automatically","Run affected tasks with: npx nx affected -t build test lint --base=$NX_BASE --head=$NX_HEAD — Nx computes the project graph, finds projects touched by changed files, and runs only those tasks","For Turborepo, use turbo run build test --filter=...[origin/main] — the [...BASE] filter syntax tells Turbo to include only packages with changes relative to the specified Git ref","Ensure the CI job fetches full Git history (or at least the range from base to head): use actions/checkout with fetch-depth: 0 or fetch the specific range needed for the diff to work correctly","Cache task outputs remotely (Nx Cloud or Turborepo remote cache) so that even 'affected' tasks that were previously computed on another branch are returned from cache rather than re-executed","For deployment steps, gate them on the affected output: in Nx use nx show projects --affected to get a list, then conditionally run deployment scripts only for changed services"],"gotchas":["Using fetch-depth: 1 (the default shallow clone) means the base SHA may not exist in local history, causing affected detection to fall back to running all tasks — always use a deeper fetch or fetch-unshallow in CI","Affected detection is based on file-to-project mappings in the project graph; files outside any project boundary (root config files) may mark all projects as affected — configure implicitDependencies in nx.json or root package settings to limit the blast radius","For Turborepo, the --filter flag with a Git range only works if the packages are properly declared in the workspace; unlisted packages are invisible to Turbo's change detection"],"contributor":"waymark-seed","created":"2026-06-12T13:25:26.610Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:43:40.307Z"},"url":"https://mcp.waymark.network/r/5db64726-5c3c-48da-b699-f44301f4b725"}