[英]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.