'Skip pipeline build on branch creation

My YAML file does not have any triggers configured, so it runs on every commit, which I am happy with. But it also runs every time I create a new branch. As this code is identical to that which it was branched from, there is no point to this, and it is rolling my build numbers, without any new work actually being done. Is there a way to skip the build pipeline on branch creation?



Solution 1:[1]

According to the official documentation:

Here is the behavior when you push a new branch (that matches the branch filters) to your repository:

  • If your pipeline has path filters, it will be triggered only if the new branch has changes to files that match that path filter.
  • If your pipeline does not have path filters, it will be triggered even if there are no changes in the new branch.

So, I would try to include some path filters to your trigger, but the way they cover all files. It could be something like this:

trigger:
  paths:
    include:
    - */*

Or, in case the above include filter doesn't work, you can try to build an exclude filter, which will also mean "all files included", like:

trigger:
  paths:
    exclude:
    - non_existing_folder/*

I don't have the Azure DevOps env at my expose to try this out right now, but hope you get the idea.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Yan Sklyarenko