How to create a tag on GitHub when a PR is merged?

谁都会走 提交于 2020-01-01 14:49:08

问题


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.

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?


回答1:


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

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

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")



来源:https://stackoverflow.com/questions/31602068/how-to-create-a-tag-on-github-when-a-pr-is-merged

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!