合并时如何从谷歌云构建触发器获取源分支
我正在将 github 拉取请求中的“feature-branch”合并到“dev-branch”上。我正在使用谷歌云构建触发器,该触发器在推送到“dev-branch”时触发。据我所知,替换变量文档,没有替代变量来获取我要合并的分支的名称 - 'feature-branch',只有我合并到的分支 - 'dev-branch'。有没有办法或解决方法来获取从推送到分支事件的谷歌云构建触发器上合并的分支的信息(名称、sha、id 等)?
I am merging 'feature-branch' onto 'dev-branch' from a github pull request. I am using a google cloud build trigger that is triggered on push to 'dev-branch'. From what I can tell in the documentation of substitution variables, there are no substitution variables to get the name of the branch that I am merging from - 'feature-branch' and only the branch that I merging to - 'dev-branch'. Is there a way or a workaround to get information (name, sha, id, etc.) of the branch that is being merged from on a google cloud build trigger from a push to branch event?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据推测,您可以在提交消息的第一行(发生在合并拉取请求“事件”时)有一些命名约定,以便该行包含源(或头) )分支名称(合并的来源 - 用你的话来说 - 'feature-branch')。
然后,您可以创建一个替换变量:
这是一个文档链接:使用负载绑定创建替换
并在某个构建步骤中使用该变量来获取
head
分支名称:之后您可以使用源分支名称。
Presumably you can have some naming conventions on the first line of the commit message (happens at
merge pull request
"event"), so that this line includes the source (orhead
) branch name (the source of the merge - in your words - 'feature-branch').Then, you can create a substitution variable:
here is a documentation link: Creating substitutions using payload bindings
And use that variable in some build step to get the the
head
branch name:After that you can use the source branch name.