git 如何在 GitHub 上运行 post-receive hook
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19041220/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to run post-receive hook on GitHub
提问by Higor Ramos
how to run a post-receive hook in GitHub?. I know that there is the web-one but I want to write a custom script and do not want to receive a post from github.
如何在 GitHub 中运行 post-receive hook?。我知道有 web-one 但我想编写一个自定义脚本并且不想收到来自 github 的帖子。
回答by VonC
The post-receive hook of Githubare actually only "WebHooks", to communicate with a web server whenever the repository is pushed to.
Github的post-receive 钩子实际上只是"WebHooks",以便在存储库被推送到时与 Web 服务器通信。
For security reason, you cannot run anything on the GitHub server side.
出于安全原因,您不能在 GitHub 服务器端运行任何内容。
When a push is made to your repository, we'll POST to your URL with a payload of JSON-encoded data about the push and the commits it contained.
当推送到您的存储库时,我们将使用有关推送及其包含的提交的 JSON 编码数据的有效负载 POST 到您的 URL。
You can use Requestbinto test your webhooks.
(check that the JSON actually comes from GitHub though)
您可以使用Requestbin来测试您的 webhooks。
(不过,请检查JSON 是否确实来自 GitHub)
Note: since late 2018, you canrun actions on GitHub server-side, with GitHub Actions.
注意:从 2018 年末开始,您可以使用GitHub Actions在 GitHub 服务器端运行操作。
Actions are triggered by GitHub platform events directly in a repo and run on-demand workflows as autoscaled containers in response.
With GitHub Actions you can automate your workflow from idea to production.
操作由 GitHub 平台事件直接在存储库中触发,并作为响应的自动缩放容器运行按需工作流。
使用 GitHub Actions,您可以自动化从创意到生产的工作流程。
See examples with sdras/awesome-actions.
请参阅带有 的示例sdras/awesome-actions。

