如何在PR合并时在GitHub上创建标签? [英] How to create a tag on GitHub when a PR is merged?

查看:569
本文介绍了如何在PR合并时在GitHub上创建标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前的工作流程需要在每个PR上都有一个版本Bump,所以我想利用它并在每次PR合并时自动在GitHub上创建一个标签,以便它出现在发布部分中。

My current workflow requires a version Bump on every PR, so I would like to take advantage of that and automatically create a tag on GitHub on every PR merge, so it appears in the "release" section.

我已经看到我可以编写一个后合并钩子。我的疑问是,如果该钩子在我的机器上本地运行,在GitHub上远程运行,或者两者兼而有之(假设我将G代码上的PR合并到本地,那么情况如何?)

I've seen that I can write a post-merge hook. My doubt is if that hook runs locally in my machine, remotely on GitHub, or both (given that I merge the PR on GitHub, and not locally. What's the case?

推荐答案


我可以编写一个合并后钩子,我的疑问是如果该钩子在本地机器上运行,远程运行在GitHub上,或者两者兼而有之b $ b

I can write a post-merge hook. My doubt is if that hook runs locally in my machine, remotely on GitHub, or both

它肯定不会在GitHub上运行(对于GitHub来说,运行用户提供的任何钩子都是不安全的)。

It will certainly not run on GitHub (that wouldn't be safe for GitHub to run any user-provided hook).

您可以通过听 Webhook提取请求:它的JSON负载,如果 PR事件 表示已合并 PR。

(也就是说,如果操作关闭,并且合并的键是 true

What you can have is a Webhook on pull request: by listening to its JSON payload, you can add a tag and push it back to GitHub if the PR event indicated a merged PR.
(That is, if the action is "closed", and the merged key is "true")

这篇关于如何在PR合并时在GitHub上创建标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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