Implement path-filtered CI triggers in a monorepo with GitHub Actions

domain: docs.github.com · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Use native path filters on push and pull_request events to trigger a workflow only when relevant files change: on: { push: { paths: ['services/api/**', 'shared/**'] } }
  2. Add paths-ignore at the workflow level to exclude documentation or config files that should not trigger builds: paths-ignore: ['docs/**', '**.md']
  3. For fine-grained per-job filtering inside a single workflow, use the dorny/paths-filter action: it outputs boolean variables per defined path pattern that you can reference in subsequent job conditions via if: needs.changes.outputs.api == 'true'
  4. Always include the workflow file itself in path filters (e.g., .github/workflows/api.yml) so that CI configuration changes are validated without requiring a source code change
  5. Include shared library paths in every service's path filter; if service A depends on shared/utils/, changes there should trigger service A's CI even if no service A files changed
  6. Be aware that paths filters on pull_request do not apply when the PR is added to a merge queue — merge_group events ignore path filters and always run the workflow

Known gotchas

Related routes

Build an affected-only CI pipeline for a Turbo or Nx monorepo with change detection
nx.dev · 6 steps · unrated
Trigger a GitHub Actions workflow via API and pass inputs
github-actions · 4 steps · unrated
Trigger a GitHub Actions workflow_dispatch event via the REST API
docs.github.com · 5 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans