使用 Github 操作设置工作流程时,针对“pull_request”事件过滤哪个分支?

Which branch is filtered on for `pull_request` events when setting up a workflow using Github Actions?

我正在尝试 运行 在 PR 起源的分支上为每个拉取请求 (PR) 构建一个特定分支的目标。如何使用 Github 操作进行设置?

令我困惑的是涉及两个分支:PR 的来源分支和目标分支。

如果 pull_request 事件被触发,documentation on pull_request events it is clear that GITHUB_REF is set to the "PR merge branch", meaning that the checkout action 将检查发起拉取请求的分支。

但是,on 的 'branches' 过滤器过滤在哪个分支上不太清楚。当在 develop 上收到 PR 时,或者当它源自它时(或者可能,两者),是否会触发以下事件?如何为 PR 特定分支设置触发器?

on:
  pull_request:
    branches: 
      - develop

我尝试使用上面的方法(在 pull_request 分支 develop 上)并将其设置为 GitHub 上的工作流。

它按照我的预期进行设置。这让我得出结论,'branches' 过滤器因此在 目标分支 .

上过滤