Monorepo Path Filter

Optimize your CI/CD pipeline by identifying which monorepo packages are affected by a list of changed files.

3. Affected Packages

 

4. GitHub Actions Matrix (JSON)

 

Frequently Asked Questions

What is a monorepo path filter?

In a monorepo (a single repository containing multiple projects), a path filter is a tool that determines which projects are affected by a given set of changed files. This is essential for optimizing CI/CD pipelines, as it allows you to only build, test, and deploy the parts of the repository that have actually changed.

How does this tool work?

You provide a configuration that maps file paths to project names (e.g., `apps/web` maps to the `web` project). Then, you provide a list of changed files. The tool uses the configuration to identify which projects those files belong to, giving you a list of affected projects.

What is a CI/CD build matrix?

A build matrix is a feature in CI/CD systems like GitHub Actions that allows you to run multiple jobs in parallel based on a set of variables. This tool can generate a matrix of the affected projects, so your CI pipeline can automatically trigger a separate job for each one.

What kind of path formats are supported?

The tool supports simple prefix matching (e.g., `apps/web`) and glob patterns (e.g., `packages/*`) to define your project paths, which covers most common monorepo setups.

Why not just build everything on every change?

In a large monorepo, building and testing every single project on every commit is incredibly slow and expensive. Path filtering saves significant time and CI/CD costs by ensuring that only the necessary work is done.