Russell Maycock
Russell Maycock

Reputation: 29

azure devops triggers trouble understanding

I've got a problem where I cannot get my pipeline to run when I want it to.

Background I have a repo in GitHub, and I'm running my pipelines in ADO.

I have two branch - main branch, feature branch.

I want a pull request to trigger a pipeline called "pull-request" when I make a pull request in github.com. I want the pipeline to exclude any changes that happen to a file called azure-pipeline-pull-request.yml (which is the pipeline file).

I don't want it to run any other time.

I have tried many different combos in the yml file, but I cannot get the pipeline to run when a PR happens.

This is the code at the top of the YAML file.

trigger:
 branches:
   include:
     - main
 paths:
   exclude:
     - azure-pipelines-pull-request.yml

pr:
  branches:
   include:
     - main
  paths:
   exclude:
     - azure-pipelines-pull-request.yml
     

I've tried it without the trigger section. I could do with some help in explaining what is happening.

Upvotes: 0

Views: 299

Answers (1)

Jane Ma-MSFT
Jane Ma-MSFT

Reputation: 5242

I tried your code and successfully triggered the pipeline to run. So some other reasons caused the pipeline not running automatically instead of your script.

There are several possible reasons for the issue. Click I just created a new YAML pipeline with CI/PR triggers, but the pipeline is not being triggered. for detailed information and steps. Here is a brief overview of the content of the document:

  1. Go to "Triggers" in UI. Turn off the "Override the YAML trigger from here" setting.
  2. Check whether your Github repository is connected to multiple Azure DevOps organizations. If so, remove the service connection and re-establish it.
  3. Check whether there is a failure in Webhooks in Github.
  4. Make sure that the YAML file in the correct branch has the necessary CI or PR configuration.
  5. Did you use templates for your YAML file? If so, make sure that your triggers are defined in the main YAML file.

Upvotes: 1

Related Questions