Home > front end >  Azure Devops pipelines to trigger on PR complete
Azure Devops pipelines to trigger on PR complete

Time:04-24

What I have to do is, I have 1 branch as below in the azure DevOps respository

  1. dev

Then I create a new branch as dev-C123456, so now I have two branches (dev and dev-C123456)

Then I do some changes to dev-C123456 and I create a Pull Request from dev-C123456 to dev. So once the changes are reviewed, the approver will Approve and Complete the pull request.

Right after he clicks Completes, I want a pipeline to run.

Here's my

And I have a auzre-piplines-on-pr.yml which will trigger the pipeline. For example, in dev branch, I have like this;

pr:
  branches:
    include:
    - dev
...

But it never triggers a pipeline, what should I do?

CodePudding user response:

Right after he clicks Completes, I want a pipeline to run.

So put a trigger for the target branch.

trigger:
  branches:
    include:
    - dev

That will run whenever a commit is made to dev, including when the commit is a PR merge commit.

CodePudding user response:

First note that pr is only for BitBucket and GitHub as per https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema/pr?view=azure-pipelines

Azure has Build Validations policies: https://docs.microsoft.com/en-us/azure/devops/repos/git/branch-policies?view=azure-devops&tabs=browser#build-validation

This builds the source branch to see if it can be properly integrated before it is actually merged.

It doesn't work exactly as you want it because it triggers whenever new commits are made rather than when it is approved but there is a manual option for the reviewer to run it if you want.

  • Related