Interview Prep/CI/CD/Fundamentals and Pipeline Design

How does CI work for a monorepo versus many repos?

IntermediateConceptFundamentals and Pipeline Design
Answer

In a monorepo, running everything on every commit is wasteful. You need change detection: path filters (on.push.paths, GitLab rules:changes), or a build graph tool (Bazel, Nx, Turborepo) that computes affected projects and caches results remotely.

With polyrepo, each repo has its own simple pipeline, but cross-service changes need coordinated PRs and shared pipeline logic must be distributed via shared libraries, reusable workflows or templates.

on:
  pull_request:
    paths:
      - 'services/payments/**'
      - '.github/workflows/payments.yml'

A gotcha: with required checks, a path-filtered workflow that does not run leaves the check pending. Use a final "gate" job that always runs.

All CI/CD questions Roadmap: CI/CD fundamentals

More on Fundamentals and Pipeline Design