如何从 Actions 中获取 GitHub 拉取请求的目标分支? [英] How to get the target branch of the GitHub pull request from an Actions?

查看:21
本文介绍了如何从 Actions 中获取 GitHub 拉取请求的目标分支?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当在 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 拉取请求的目标分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆