'How to exclude tagged commit

I have a build pipeline in Azure Pipelines with

trigger:
  branches:
    include:
    - '*'
  tags:
    include:
    - v/*

In other words: I build all branches (in practice I only have one), and all tags that start with v/ (these are my releases).

When I push a commit and its tag, Azure Pipelines kicks off two builds - one for the branch and one for the tag - even though they're the same commit. This takes up unnecessary pipeline resources, particularly when I want to release from many repositories at the same time.

Is there a way to skip the "branch build" of a commit (or cancel if ongoing) when a "tag build" of the same commit is started?



Sources

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

Source: Stack Overflow

Solution Source