GitHub:Enterprise post-receive hook

旧城冷巷雨未停 提交于 2019-12-07 01:46:43

问题


Does anyone know if there is a mechanism in GitHub:Enterprise to set up a general post-receive hook that will apply to all repositories (including new ones as soon as they are created?)

I am trying to develop a link to a secondary system that will want to get notified of all pushes to all repositories, and requiring manual set-up for each new repository will just be a matter of time before it gets forgotten.


回答1:


I know that this is really old, but GitHub Enterprise 2.6 just came out with pre-receive hooks. More information can be learned here: https://help.github.com/enterprise/admin/guides/developer-workflow/using-pre-receive-hooks-to-enforce-policy/.

This should answer the question originally posted, as this is something that gets set up at an instance level (thus, it is only on GitHub Enterprise) and will work for all repositories.

I am trying to develop a link to a secondary system that will want to get notified of all pushes to all repositories, and requiring manual set-up for each new repository will just be a matter of time before it gets forgotten.

As for this piece, another thing you could look into would be log forwarding on GitHub. You can read about log forwarding here: https://help.github.com/enterprise/admin/articles/log-forwarding. You can also control multiple log forwarding destinations as of version 2.6




回答2:


GithubCLI is an easy way to interact with GitHub Enterprise and allows you to add post-receive hooks from the command line. Linking this with listing repositories you could have a cron job that makes sure all repositories have a specific post-receive hook.

You could also use the REST API directly or one of the many binding libraries like github_api. For Enterprise it's fairly easy. The API endpoint is http(s)://your-company/api/v3.

It's not an ideal solution, but the API is pretty easy to work with. Hope that helps!



来源:https://stackoverflow.com/questions/12188798/githubenterprise-post-receive-hook

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