Search code examples
azure-devopstriggersazure-pipelinesrepository

How can I trigger a pipeline of RepoA when something is pushed inside another repository RepoB within Azure DevOps?


I tried to figure this out, but came to no results. Does anyone know how to trigger a pipeline of a .NET project let's say RepoA when something is pushed inside another Repo called RepoB? I want to apply this feature to the pipeline of RepoA, because RepoB does not have a pipeline and I do not want a pipeline for RepoB.


Solution

  • How can I trigger a pipeline of RepoA when something is pushed inside another repository RepoB within Azure DevOps?

    In Azure DevOps Pipeline, you can add the Repo B as Repo Resources in the pipeline of Repo A and set the trigger.

    resources:
      repositories:
      - repository: RepoB
        type: git
        name: MyProject/RepoB
        trigger:
         branches:
          include:
            - main
    
    pool:
      vmImage: ubuntu-latest
    
    steps:
    - checkout: RepoB
    - checkout: self
    

    For more detailed info, you can refer to this doc: Define a repositories resource