Azure Pipelines:根级别文件的文件触发器

Azure Pipelines: file-trigger for files on root level

如何将根级别的所有文件作为触发器添加到 Azure Devops - 管道?

目前我的设置是这样的:

pr:
  branches:
    include:
      - '*'
  paths:
    include:
      - '*' # this matches all files in the repository
      - apps/*

目的是通过更改根级文件(即 package.json)和应用程序文件夹中的文件来触发 pr-build。但是,包括 * 确实匹配我存储库中的所有文件而不是根级文件。

documentation 帮不了我。有没有一种方法可以将所有根级文件包含到触发器中,而无需手动包含每个文件?

如果您希望仅针对根文件夹中的更改触发管道,您需要排除 exclude 部分中的所有文件夹:

pr:
 branches:
   include:
     - master
 paths:
   include:
     - '*'
   exclude:
     - 'Whosebug/*'
     - 'abc/*'
     - 'xyz/*'

这里同意 Krzysztof Madej 的观点,'*' # same as '/' for the repository root,这里是 document 你可以参考。如果不希望根目录下的文件夹sub-files触发管道,需要在paths过滤器中添加exclude

例如:

trigger:
      branches:
        include:
         - master
      paths:
        include:
         - '*'
        exclude:
          - '/test01/'

然后对 test0 文件的更改将不会触发管道。