Search code examples
azureazure-devopsazure-pipelinesbuild-triggers

Azure Devops build pipeline: CI triggers not working on PR merge to master when PR set to none


Need to trigger CI build job when a PR is merged to master (only when change is inside ./rel/* path) but not have CI build triggered when the Pull Request (PR) is created. So I have the trigger config as below.

trigger:
    branches:
        include:
        - master
    paths:
        include:
        - ./rel/*

pr: none # will disable PR builds (but not CI builds)

But it fails to trigger CI build when pr: none is added. If pr: none is removed, The Job is getting triggered for both PR and a merge to master. I would only need the job/CI build to run on a merge to master.


Solution

  • Solved! This works now.

    trigger:
        branches:
            include:
            - master
        paths:
            include:
            - ./rel/*
    
    pr: none # will disable PR builds (but not CI builds)
    

    Also you can configure / override using the classic azure devops UI from Triggers.

    Ref : https://learn.microsoft.com/en-us/azure/devops/pipelines/repos/azure-repos-git?view=azure-devops&tabs=classic#ci-triggers

    PR trigger

    CI trigger