简体   繁体   English

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

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

I am trying to run a build for each pull request (PR) on the branch from which the PR originates, whenever a specific branch is being targeted.每当针对特定分支时,我都会尝试在 PR 源自的分支上为每个拉取请求 (PR) 运行构建。 How do I set this up using Github Actions?如何使用 Github 操作进行设置?

What confuses me is two branches are involved: the branch from which the PR originates, and the target branch.让我感到困惑的是涉及两个分支:PR 源自的分支和目标分支。

From the documentation on pull_request events it is clear that GITHUB_REF is set to the "PR merge branch", meaning that the checkout action will check out the branch from which the pull request originates in case the pull_request event is triggered.有关pull_request事件的文档中可以清楚地看出GITHUB_REF设置为“PR 合并分支”,这意味着在触发pull_request事件的情况下,检出操作将检出拉取请求所源自的分支。

But, it is less clear which branch the 'branches' filter of on filters on.但是,不太清楚on过滤器的“分支”过滤器在哪个分支上。 Would the following event trigger when a PR is received on develop, or when it originates from it (or possibly, both)?当在开发中收到 PR 时,或者当它源自它(或可能,两者)时,是否会触发以下事件? How do I set up a trigger for PRs to a specific branch?如何特定分支的 PR 设置触发器?

on:
  pull_request:
    branches: 
      - develop

I tried using the above (on pull_request branches develop) and set it up as a workflow on GitHub.我尝试使用上述方法(在 pull_request 分支开发上)并将其设置为 GitHub 上的工作流。

It worked as I intended to set it up.它按照我打算设置的方式工作。 This makes me conclude that the 'branches' filter thus filters on the target branch .这使我得出结论,“分支”过滤器因此过滤了目标分支

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 GitHub 工作流程中安排和 push/pull_request 事件? - How having schedule AND push/pull_request events in a GitHub workflow? Github Actions:工作流不会在另一个工作流发出的 pull_request 上启动 - Github Actions: Workflow doesn't start on pull_request made by another workflow Github 操作:寻找对拉取请求事件和工作流调度事件均可见的分支级别属性 - Github actions: Seeking a branch level property that is visible to both pull request events and workflow dispatch events 在 push 和 pull_request 上限制 GitHub 操作工作流并发? - Limit GitHub action workflow concurrency on push and pull_request? 在仓库中的分支上使用 pull_request 与 pull_request_target - Using pull_request vs pull_request_target on a branch within a repo 有没有办法强制 Github 操作在来自分支的拉取请求触发器中使用主分支工作流文件? - Is there a way to force Github actions use main branch workflow files in a pull request trigger from a fork? Github 对拉取请求和主分支的操作 - Github actions on pull request and master branch Github 操作:当对主分支完成拉取请求时,在服务器上运行“git pull” - Github Actions: run 'git pull' on server when a pull request is done to the master branch Github 另一个 repo 更新的动作触发器(push,pull_request) - Github Action trigger on another repo update (push, pull_request) 通用 pull_request 事件和其他更具体的 pull_request 事件(如 pull_request.opened)的意义 - Significance of the generic pull_request event and other more specific pull_request events like pull_request.opened
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM