Skip to content
Latchkey

How to Trigger on Branches, Tags, and Paths in Azure Pipelines

The trigger block includes and excludes branches, tags, and paths so a run only starts for commits you care about.

Set trigger with branches, tags, and paths, each supporting include and exclude lists. A push runs the pipeline only when it matches the include filters and not the excludes.

Steps

  • Add a trigger block with branches.include.
  • Add paths.include/paths.exclude to scope by directory.
  • Add tags.include to also run for matching tags.

Pipeline

azure-pipelines.yml
trigger:
  branches:
    include:
      - main
      - releases/*
  tags:
    include:
      - v*
  paths:
    include:
      - services/api/**
    exclude:
      - docs/**
steps:
  - script: cd services/api && npm ci && npm test

Gotchas

  • Branch names in filters are bare (main), not refs/heads/main.
  • paths filters only apply to branch triggers, not to tag triggers.
  • Setting trigger: none disables CI runs so the pipeline only runs manually or on a schedule.

Related guides

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