Share via


pr definition

A pull request trigger specifies which branches cause a pull request build to run.

Definitions that reference this definition: pipeline

Implementations

Implementation Description
pr: none Disable pull request triggers.
pr: string list List of branches that trigger a run.
pr: autoCancel, branches, paths Full syntax for complete control.
Implementation Description
pr: none Disable pull request triggers.
pr: string list List of branches that trigger a run.
pr: branches, paths Full syntax for complete control.

Remarks

If you specify no pull request trigger, pull requests to any branch trigger a build.

There are three distinct syntax options for the pr keyword: a list of branches to include, a way to disable PR triggers, and the full syntax for complete control.

Important

YAML PR triggers are supported only in GitHub. If you use Azure Repos Git, you can configure a branch policy for build validation to trigger your build pipeline for validation.

Important

When you specify a pull request trigger, only branches that you explicitly configure for inclusion trigger a pipeline. Inclusions are processed first, and then exclusions are removed from that list. If you specify an exclusion but no inclusions, nothing triggers.

pr: none

Disable pull request triggers.

pr: none # Disable pull request triggers.

pr string. Allowed values: none.

Disable pull request triggers.

Examples

Disablement syntax:

pr: none # will disable PR builds (but not CI builds)

pr: string list

List of branches that trigger a run.

pr: [ string ] # List of branches that trigger a run.

List types

Type Description
string List of branches that trigger a run.

Remarks

The list syntax specifies a list of branches which trigger a run when a pull request is raised or a push is made to the source branch of a raised pull request.

Examples

List syntax:

pr:
- main
- develop

pr: autoCancel, branches, paths

Full syntax for complete control.

pr:
  autoCancel: boolean # Whether to cancel running PR builds when a new commit lands in the branch. Default: true.
  branches: # Branch names to include or exclude for triggering a run.
    include: [ string ] # List of items to include.
    exclude: [ string ] # List of items to exclude.
  paths: # File paths to include or exclude for triggering a run.
    include: [ string ] # List of items to include.
    exclude: [ string ] # List of items to exclude.

Properties

autoCancel boolean.
Whether to cancel running PR builds when a new commit lands in the branch. Default: true.

branches includeExcludeFilters.
Branch names to include or exclude for triggering a run.

paths includeExcludeFilters.
File paths to include or exclude for triggering a run.

pr: branches, paths

Full syntax for complete control.

pr:
  branches: # Branch names to include or exclude for triggering a run.
    include: [ string ] # List of items to include.
    exclude: [ string ] # List of items to exclude.
  paths: # File paths to include or exclude for triggering a run.
    include: [ string ] # List of items to include.
    exclude: [ string ] # List of items to exclude.

Properties

branches includeExcludeFilters.
Branch names to include or exclude for triggering a run.

paths includeExcludeFilters.
File paths to include or exclude for triggering a run.

Examples

Full syntax:

pr:
  branches:
    include:
    - features/*
    exclude:
    - features/experimental/*
  paths:
    exclude:
    - README.md

See also

Learn more about pull request triggers and how to specify them.