Build watch paths

Last updated Apr 21, 2026 When you connect a git repository to Pages, by default a change to any file in the repository will trigger a Pages build. You can configure Pages to include or exclude specific paths to specify if Pages should skip a build for a given path. This can be especially helpful if you are using a monorepo project structure and want to limit the amount of builds being kicked off.

Configure paths

To configure which paths are included and excluded:

  1. Go to the Workers & Pages in the Cloudflare dashboard. Go to Workers & Pages ↗
  2. Find your Pages project.
  3. Go to Settings > Build > Build watch paths. Pages will default to setting your project's includes paths to everything ([*]) and excludes paths to nothing ( []).

The configuration fields can be filled in two ways:

  • Static filepaths: Enter the precise name of the file you are looking to include or exclude (for example, docs/README.md).
  • Wildcard syntax: Use wildcards to match multiple paths. You can specify wildcards at the start or end of your rule.

Wildcard syntax

A wildcard (*) matches zero or more characters, including path separators (/). This means a single * at the end of a path pattern will match files in nested subdirectories as well. For example:

  • docs/* matches docs/README.md, docs/guides/setup.md, and docs/guides/advanced/config.md.
  • *.md matches README.md, docs/README.md, and src/content/guide.md.
  • * alone matches all files in the repository.

For each path in a push event, build watch paths will be evaluated as follows:

  • Paths satisfying excludes conditions are ignored first
  • Any remaining paths are checked against includes conditions
  • If any matching path is found, a build is triggered. Otherwise the build is skipped

Pages will bypass the path matching for a push event and default to building the project if:

  • A push event contains 0 file changes, in case a user pushes an empty push event to trigger a build
  • A push event contains 3000+ file changes or 20+ commits

Examples

Trigger builds for specific directories (monorepo)

If you want to trigger a build only when files change within specific directories, such as project-a/ and packages/. Because * matches across path separators, this includes changes in nested subdirectories like project-a/src/index.js or packages/utils/lib/helpers.ts.

  • Include paths: project-a/*, packages/*
  • Exclude paths: ``

Exclude a directory from triggering builds

If you want to trigger a build for any changes, but want to exclude changes to a certain directory, such as all changes in a docs/ directory (including nested paths like docs/guides/setup.md).

  • Include paths: *
  • Exclude paths: docs/*

Trigger builds for a specific filetype

If you want to trigger a build for a specific file or specific filetype, for example all .md files anywhere in the repository.

  • Include paths: *.md
  • Exclude paths: ``

Trigger builds for a directory but exclude a subdirectory

If you want to trigger a build for changes in src/ but want to ignore changes in src/tests/.

  • Include paths: src/*
  • Exclude paths: src/tests/*

Was this helpful?

YesNo

On this page

Build watch paths - 图1Docs

{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/pages/configuration/build-watch-paths/#page","headline":"Build watch paths","description":"Configure which file paths trigger or skip a Cloudflare Pages build when changes are pushed.","url":"https://developers.cloudflare.com/pages/configuration/build-watch-paths/","inLanguage":"en","image":"https://developers.cloudflare.com/pages/configuration/build-watch-paths/og.png?v=9ff01f6f6352fda3","dateModified":"2026-04-21","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}


description: Add custom domains and subdomains to your Cloudflare Pages project. title: Custom domains image: https://developers.cloudflare.com/pages/configuration/custom-domains/og.png?v=bfd8711470c042b9


Skip to content

Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/pages/llms.txt
Use this file to discover all available pages before exploring further.