my Github to DevOps pull request generates two pipeline runs; why?

JB Johnson 20 Reputation points
2025-04-03T21:52:23.92+00:00

I'm using Visual Studio Community 2022, Azure Web App, ASP.NET, C#, Net 4.6+, Github and DevOps. I'm the only one currently working on the code.

I have four deployment stages: local, dev, staging and prod (+ prod swap)
Typical pattern is:

  • create a copy in local from dev remote
  • add commits to that local, and push to remote
  • pull request from local-on-remote to dev-on-remote
  • test
  • pull requests from dev to staging, staging to prod swap, then swap, with testing along the way.
    The YAMLs for dev, staging and prod all have the same pattern (see below: different depending on the branch)

The issue is that in the "local-on-dev to dev" pull request in github generates two pipelines. One has subtext "Individual CI" and the other has subtext "PR Automated".

This does not happen in the other pull requests and pipeline runs.

I can see the PR merge request being initiated in the validation of the pull request in Github.

The double pipeline run eats time and seems unnecessary.

How can I avoid the double pipeline run?

trigger:
  #added next two lines to remove need for change source branch to be present 9/27/2024
  branches:
    include:
      - AMPTK_DEVELOPMENT_MASTER
    exclude:
      - AMPTK_STAGING_MASTER
      - AMPTK_PRODUCTION_MASTER
      
pr:
  branches:
    include:
      - AMPTK_DEVELOPMENT_MASTER
    exclude:
      - AMPTK_PRODUCTION_MASTER
      - AMPTK_STAGING_MASTER


Azure DevOps
{count} votes

Accepted answer
  1. Bodapati Harish 820 Reputation points Microsoft External Staff Moderator
    2025-04-04T10:04:36.3+00:00

    Hello @JB Johnson ,

    Your pipeline runs twice because:

    • The trigger section starts a CI pipeline when code is pushed.
    • The pr section starts the PR_automated pipeline for pull requests.

    When you create a PR, a push to the source branch (e.g., dev-remote) triggers the CI pipeline, and the PR event triggers the PR_automated pipeline, causing both to run.

    To prevent the individual CI pipeline from running on PR-related pushes, you need to add an exclude list to the trigger section. This will ensure that certain branches, such as dev-remote, do not trigger the pipeline separately

    Updated YAML file:

    
    trigger:
    
      branches:
    
        include:
    
          - AMPTK_DEVELOPMENT_MASTER
    
          - AMPTK_STAGING_MASTER
    
          - AMPTK_PRODUCTION_MASTER
    
        exclude:
    
          - dev-remote  # Exclude the source branch used for PRs
    
          - feature/*   # Optionally exclude feature branches
    
          - bugfix/*    # Optionally exclude bugfix branches
    
    pr:
    
      branches:
    
        include:
    
          - AMPTK_DEVELOPMENT_MASTER
    
          - AMPTK_STAGING_MASTER
    
          - AMPTK_PRODUCTION_MASTER
    
    

    Update the YAML file with the changes, save and push it to your repository, then create a test pull request to verify that only the PR_automated pipeline runs.

    Hope this helps!


    If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.