pr 定義

提取要求觸發程式會指定哪些分支導致提取要求組建執行。

參考此定義的定義: 管線

實作

實作 描述
pr:無 停用提取要求觸發程式。
pr:字串清單 觸發執行的分支清單。
pr:autoCancel、分支、路徑、草稿 完整控制項的完整語法。
實作 描述
pr:無 停用提取要求觸發程式。
pr:字串清單 觸發執行的分支清單。
pr:autoCancel、分支、路徑 完整控制項的完整語法。
實作 描述
pr:無 停用提取要求觸發程式。
pr:字串清單 觸發執行的分支清單。
pr:分支、路徑 完整控制項的完整語法。

備註

如果您未指定提取要求觸發程式,則提取要求至任何分支會觸發組建。

關鍵字有三個不同的語法選項 pr :要包含的分支清單、停用 PR 觸發程式的方法,以及完整控制的完整語法。

重要

只有在 GitHub 和 Bitbucket Cloud 中才支援 YAML PR 觸發程式。 如果您使用 Azure Repos Git,您可以設定組建驗證的分支原則,以觸發建置管線以進行驗證。

重要

只有在 GitHub 中才支援 YAML PR 觸發程式。 如果您使用 Azure Repos Git,您可以設定組建驗證的分支原則,以觸發建置管線以進行驗證。

如果您為 或 指定 exclude 沒有 子句的 includebranches 子句,則相當於在 include 子句中指定 *paths

重要

當您指定提取要求觸發程式時,只有明確設定為包含觸發管線的分支。 系統會先處理包含專案,然後從該清單中移除排除專案。 如果您指定排除但不包含任何專案,則不會觸發任何觸發程式。

pr:無

停用提取要求觸發程式。

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。

branchesincludeExcludeFilters
要包含或排除以觸發執行的分支名稱。

pathsincludeExcludeFilters
要包含或排除以觸發回合的檔案路徑。

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。

branchesincludeExcludeFilters
要包含或排除以觸發執行的分支名稱。

pathsincludeExcludeFilters
要包含或排除以觸發回合的檔案路徑。

pr:分支、路徑

完整控制項的完整語法。

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.

屬性

branchesincludeExcludeFilters
要包含或排除以觸發執行的分支名稱。

pathsincludeExcludeFilters
要包含或排除以觸發回合的檔案路徑。

範例

完整語法:

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

另請參閱

深入瞭解 提取要求觸發程式 ,以及如何指定它們。