Trigger Pipeline when there's a change in Github repository


I’ve been reading a lot of different posts and documentation about this topic. I also took a look in another similar question: GitHub build trigger on PR

I was wondering if exists a way to trigger a pipeline checking if there’s some change in a GitHub repository (when it’s opened a PR or when it’s merged - maybe checking with some hash the last commit and check if it changed git rev-parse HEAD).

I can’t use webhooks because the Jenkins is local.

Any idea?

Thank you very much.

Can you try if multibranch pipeline does what you want? It will scan the repo and start jobs if there are any changes.

Thank you for your answer @saper . I’ll take a look into this and check if it’s possible to use this option without adding the Jenkinsfile in the repository. The idea is to execute a pipeline that already exists in the Jenkins side just if there’s a change. Maybe it can works.

I’ll let you know.

Thank you again!

It works really nice. Thank you very much!

1 Like