Azure管道从资源存储库读取文件

Azure管道从资源存储库读取文件,azure,azure-devops,Azure,Azure Devops,我正在引用azure管道模板中的存储库,如下所示: resources: repositories: - repository: MyRepo type: git name: MyRepoName ref: MyRepoRef 我想知道是否可以读取引用存储库中的文件内容,该存储库中是另一个正在管道中执行的yaml。如果我们在管道中使用另一个回购,我们可以读取引用存储库中的文件内容。我们可以参考此了解更多详细信息 在我的测试中,项目名称是test

我正在引用azure管道模板中的存储库,如下所示:

resources:
  repositories:

    - repository: MyRepo
      type: git
      name: MyRepoName
      ref: MyRepoRef

我想知道是否可以读取引用存储库中的文件内容,该存储库中是另一个正在管道中执行的yaml。

如果我们在管道中使用另一个回购,我们可以读取引用存储库中的文件内容。我们可以参考此了解更多详细信息

在我的测试中,项目名称是
test
,引用的存储库是
test
,当前存储库是
sample
,然后我读取文件
pull\u request\u template.md

YAML生成定义:

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'
结果: