0

I need to trigger the pipeline(CI) when any change is made (directly to the branch or by merging a PR) to my_branch, my yml trigger configuration is like this -

trigger:
  batch: true
  branches:
    include:
      - my_branch
  paths:
    include:
      - path/of/the/directory

This works fine if a work item is attached with a PR and the PR is merged with the my_branch.

But, when there is no work item attached to a PR - CI is not triggering after merging the PR.

Am I missing anything?

hasnayn
  • 356
  • 4
  • 22

1 Answers1

1

I tried to reproduce the same in my environment and got the results successfully like below:

 Step 1: Created a sample repository. (No branch policies are applied at this stage) 

Step 2: Create a basic yaml build pipeline as below. 

trigger:
branches:
batch: true
include:
- main
pool:
vmImage: ubuntu-latest
steps:
- script: echo Hello, world!
displayName: 'Sample script'

Step 3: Create a new branch from the main branch. 

enter image description here enter image description here 

Step 4: Modify or add some code to the newly created branch and create a Pull Request to the main branch and verify build pipeline.

 enter image description here enter image description here enter image description here enter image description here 

Note: As I did not set any pull request policies on the main branch, the build pipeline will get triggered only after the feature branch merged to the main branch.

Sourav
  • 814
  • 1
  • 9