如何从Actions获取GitHub pull请求的目标分支? [英] How to get the target branch of the GitHub pull request from an Actions?
本文介绍了如何从Actions获取GitHub pull请求的目标分支?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Github Actions中的 pull_request
上设置了动作后,如何获取目标分支?用例是检索特定于PR(可能是分支)的提交.
When an action is set on pull_request
in Github Actions, how to get the target branch? The use case is to retrieve the PR- (and hopefully, branch)-specific commits.
推荐答案
您可以使用 $ {{github.event.pull_request.base.ref}}
访问目标分支.
You can access the target branch with ${{ github.event.pull_request.base.ref }}
.
要了解 github.event
对象的属性的完整列表,请尝试运行 more $ GITHUB_EVENT_PATH
.
To know the full list of properties of the github.event
object, try to run more $GITHUB_EVENT_PATH
.
这篇关于如何从Actions获取GitHub pull请求的目标分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文