拉取请求触发器指定哪些分支导致拉取请求生成运行。
引用此定义的定义:管道
实现
执行 | 说明 |
---|---|
pr:无 | 禁用拉取请求触发器。 |
pr:字符串列表 | 触发运行的分支列表。 |
pr:autoCancel、分支、路径、草稿 | 完整控件的完整语法。 |
执行 | 说明 |
---|---|
pr:无 | 禁用拉取请求触发器。 |
pr:字符串列表 | 触发运行的分支列表。 |
pr:autoCancel、分支、路径 | 完整控件的完整语法。 |
注解
如果未指定拉取请求触发器,则对任何分支的拉取请求将触发生成。
pr
关键字有三个不同的语法选项:要包括的分支列表、禁用 PR 触发器的方法以及完整控件的完整语法。
重要
YAML PR 触发器仅在 GitHub 和 Bitbucket Cloud 中受支持。 如果使用 Azure Repos Git,则可以配置 分支策略进行生成验证 以触发生成管道进行验证。
如果为 exclude
或 include
指定没有 branches
子句的 paths
子句,则等效于在 *
子句中指定 include
。
pr: none
禁用拉取请求触发器。
pr: none # Disable pull request triggers.
pr
字符串。 允许的值:无。
禁用拉取请求触发器。
例子
禁用语法:
pr: none # will disable PR builds (but not CI builds)
pr:字符串列表
触发运行的分支列表。
pr: [ string ] # List of branches that trigger a run.
列表类型
类型 | 说明 |
---|---|
字符串 | 触发运行的分支列表。 |
注解
列表语法指定在引发拉取请求或向引发拉取请求的源分支发出推送时触发运行的分支列表。
例子
列表语法:
pr:
- main
- develop
pr:autoCancel、分支、路径、草稿
需要完全控制拉取请求触发器时,请使用完整语法。
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.
性能
autoCancel
布尔。
在新提交登陆分支时是否取消正在运行的 PR 生成。 默认值:true。
branches
includeExcludeFilters。
要包含或排除的分支名称以触发运行。
paths
includeExcludeFilters。
要包含或排除用于触发运行的文件路径。
drafts
布尔。
创建草稿 PR 时是否启动运行。 默认值:true。
pr:autoCancel、分支、路径
完整控件的完整语法。
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.
性能
autoCancel
布尔。
在新提交登陆分支时是否取消正在运行的 PR 生成。 默认值:true。
branches
includeExcludeFilters。
要包含或排除的分支名称以触发运行。
paths
includeExcludeFilters。
要包含或排除用于触发运行的文件路径。
例子
完整语法:
pr:
branches:
include:
- features/*
exclude:
- features/experimental/*
paths:
exclude:
- README.md
另请参阅
详细了解 拉取请求触发器 以及如何指定它们。