GitHub:Enterprise post-receive hook

2020-08-26 03:44发布

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.

2条回答
祖国的老花朵
2楼-- · 2020-08-26 04:13

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!

查看更多
Viruses.
3楼-- · 2020-08-26 04:21

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

查看更多
登录 后发表回答