Warm tip: This article is reproduced from serverfault.com, please click

其他-打开github PR(Azure管道YAML)时未触发pr

(其他 - pr not triggered when opening github PR (Azure pipeline YAML))

发布于 2020-11-27 09:49:04

目标

我对Azure和管道非常陌生,并且我想从Azure中公关触发管道该回购协议位于Github中。

这是管道yaml:pipeline.yml

trigger: none # I turned this off for to stop push triggers (but they work fine)

pr:
  branches:
    include:
      - "*" # This does not trigger the pipeline 

stages:
  - stage: EchoTriggerStage
    displayName: Echoing trigger reason
    jobs:
      - job: A
        steps:
          - script: echo 'Build reason::::' $(Build.Reason)
            displayName: The build reason

# ... some more stages here triggered by PullRequests....
# ... some more stages here triggered by push (CI)....

Github上的公关看起来像这样: 在此处输入图片说明

问题

但是,当推式触发器可以正常工作时,不会触发管道。

我已经阅读了文档,但看不到为什么这不起作用。

当我通过触发时,管道运行正常git push但是,当我尝试用Github的PR触发它时,什么也没发生。在上面的代码中,我尝试关闭推式触发器,并允许所有PR触发管道。依然没有。

我还不想删除管道并创建一个新管道。

更新

我更新了yaml文件,使其按照下面的建议工作。由于管道现在实际上是通过push命令运行的,因此yaml文件的其余详细信息无关紧要,因此被忽略了。

我尝试过的其他东西

  • 在Github上打开新的PR
  • 在Github上关闭/重新打开PR
  • 更改Github上的现有PR

->仍然不会触发管道。

Questioner
meerkat
Viewed
11
9,751 2020-12-02 21:01:57

解决方案是转到Azure管道->编辑管道->触发器->启用PR验证。