Skip to content

Latest commit

 

History

History
391 lines (309 loc) · 12.5 KB

File metadata and controls

391 lines (309 loc) · 12.5 KB
title description ms.date monikerRange
pr definition
Pull request trigger.
03/02/2023
>=azure-pipelines-2019

pr definition

:::moniker range=">=azure-pipelines-2019"

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

:::moniker-end

:::moniker range=">=azure-pipelines-2019"

Definitions that that reference this definition: pipeline

:::moniker-end

Implementations

:::moniker range=">=azure-pipelines-2022"

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

:::moniker-end

:::moniker range=">=azure-pipelines-2019.1 <=azure-pipelines-2020.1"

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.

:::moniker-end

:::moniker range="=azure-pipelines-2019"

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.

:::moniker-end

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.

::: moniker range="azure-pipelines"

Important

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

::: moniker-end

::: moniker range=">= azure-pipelines-2019 <= azure-pipelines-2019.1"

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.

::: moniker-end

::: moniker range=">= azure-pipelines-2020"

If you specify an exclude clause without an include clause for branches or paths, it is equivalent to specifying * in the include clause.

::: moniker-end

::: moniker range="<= azure-pipelines-2019.1"

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.

::: moniker-end

:::moniker range=">=azure-pipelines-2019"

pr: none

Disable pull request triggers.

pr: none # Disable pull request triggers.

pr string. Allowed values: none.

Disable pull request triggers.

:::moniker-end

Examples

Disablement syntax:

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

:::moniker range=">=azure-pipelines-2019"

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.

:::moniker-end

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

:::moniker range=">=azure-pipelines-2022"

pr: autoCancel, branches, paths, drafts

Use the full syntax when you need full control of the pull request trigger.

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.
  drafts: boolean # Whether to start a run when a draft PR is created. Default: true.

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.

drafts boolean.
Whether to start a run when a draft PR is created. Default: true.

:::moniker-end

:::moniker range=">=azure-pipelines-2019.1 <=azure-pipelines-2020.1"

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.

:::moniker-end

:::moniker range="=azure-pipelines-2019"

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.

:::moniker-end

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.