title: How to automatically 'git tag -a' after a pull request has completed on Azure Devops?
body: <p>How do we add custom annotated tags on <code>master</code> once the pull requests (PR) is complete, <strong>automatically</strong>?</p>
  
  <p>More background:</p>
  
  <ul>
  <li>Using <code>azure-pipelines.yml</code></li>
  <li>Branch policies on <code>master</code> to force PR to be used</li>
  <li>We have a repository that holds Azure Devops Pipeline Templates ("devops templates repo")</li>
  <li>Other repos have a root pipeline file that references the "devops template" repo</li>
  <li>We use SEMVER for tagging our products, including the devops template repo</li>
  <li>In root pipelines we wish to pin to a SEMVER release of the devops template repo</li>
  <li>We currently tag <em>manually</em> with each of the following to point to the merge commit that occurred after the PR completed
  
  <ul>
  <li>"v<code>MAJOR</code>.<code>MINOR</code>.<code>PATCH</code>"</li>
  <li>"v<code>MAJOR</code>.<code>MINOR</code>"</li>
  <li>"v<code>MAJOR</code>"</li>
  </ul></li>
  </ul>
  
  <p>Pin on <code>MAJOR</code> only example:</p>
  
  <pre class="lang-yaml prettyprint-override"><code>resources:
    repositories:
      - repository: templates
        type: git
        name: template_devops_pipelines
        ref: "refs/tags/v1"
  </code></pre>