If we use another repo in the pipeline, we could read the content of a file in the referenced repository. We could refer this link for more details
In my test, project name is test, the referenced repository is test and current repository is sample, then I read the content of file pull_request_template.md
YAML build definition:
trigger: none
resources:
repositories:
- repository: test
type: git
name: test/test
ref: master
steps:
#checkout referenced repository
- checkout: test
#List SourcesDirectory files
- task: Bash@3
inputs:
targetType: 'inline'
script: 'ls ''$(Build.SourcesDirectory)'''
#Read the contents of the file pull_request_template.md
- task: PowerShell@2
inputs:
targetType: 'inline'
script: 'Get-Content -Path $(Build.SourcesDirectory)\pull_request_template.md'
Result:
