Azure-devops-docs: Branch policy triggers missing section about 'Path Filters'

Created on 14 Aug 2018  Â·  6Comments  Â·  Source: MicrosoftDocs/azure-devops-docs

This seems a little outdated, VSTS options for branch policiy PR validation have extended to include a 'Path Filter'


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Pri1 devops-code-gitech devopprod doc-bug

All 6 comments

In the meantime does anyone have an example of how to only exclude a particular directory?

!/Test
to exclude the Test Directory

That does not seem to work.

To cite the tooltip:

If a path filter is set, the policy will only apply when files which match the filter are changed. Leaving this field blank means that the policy will always apply.

You can specify absolute paths and wildcards
Example: /WebApp/Models/Data.cs, /WebApp/*, or *.cs

You can specify multiple paths using ";" as a separator
Example:
/WebApp/Models/Data.cs;ClientApp/Models/Data.cs

Paths prefixed with "!" are excluded
Example: /WebApp/;!/WebApp/Tests/

Order is significant

How do I ignore a single file?
*;!README.md does not work.
/*;!README.md does not work.

/*;!/README.md worked.

I found a comment on an issue that appears to solve the problem:

Your first example is not going to work because if you apply a filter, we automatically exclude all files. [...] you aren't including anything, so that is why nothing runs.

You have to include everything, and then exclude the files/folders you don't want. This isn't clear from the tooltip.

Was this page helpful?
0 / 5 - 0 ratings