tyrell_c
tyrell_c

Reputation: 511

How to trigger jenkins every time a repository is created on github org?

I know how to trigger jenkins if a push is made to a repo but for this instance, I have a github organization and want to trigger jenkins when a repository is made on this github organization (to add webhooks and teams). I have an org-level hook but there isn't a place to specify a trigger. The git plugin specifically asks for a repository url.

I was going to create a repo that gets updated with list of repositories and have that repo as the hook but that sounds over-engineered. Any other easier way to do this?

Upvotes: 2

Views: 427

Answers (1)

VonC
VonC

Reputation: 1324248

Organization webhooks (introduced in December 2014) can be made for any events, including creation events (which include repository creation)

You should be able to register one, with a Jenkins server URL as listener. Since the Jenkins GitHub plugin might not process your exact webjook JSON payload, that URL could be one of a custom listener, able to notify your Jenkins.
See for instance worg/hookah.

Upvotes: 2

Related Questions