Skip to content
Latchkey

How to Use Trigger and Branch Filters in Azure Pipelines

The trigger and pr keys decide which branches start CI runs, with include/exclude lists and path filters.

Use trigger: for CI on push and pr: for validation builds. Each supports branches and paths include/exclude to scope runs.

Branch and path filters

Run CI on main and release branches, but only when source files change.

azure-pipelines.yml
trigger:
  branches:
    include:
      - main
      - releases/*
  paths:
    include:
      - src/*
    exclude:
      - docs/*
pr:
  branches:
    include:
      - main

Gotchas

  • For Azure Repos, pr: triggers work in YAML; for GitHub repos, PR triggers may rely on branch policies instead.
  • Setting trigger: none disables CI triggering entirely (useful for manual-only or template pipelines).
  • Path filters help monorepos, but a build with no matching paths is skipped, not failed.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →