I’m currently working on a CI/CD setup during my internship, and I want to trigger a Jenkins build automatically whenever a Pull Request (PR) is created on a GitHub repository.
Here’s my context:
- I’m using Jenkins running locally (localhost).
- Jenkins just calls an external script to compile the project.
- I already tested calling the GitHub REST API, and it works fine — but this involves using an external script to fetch PRs.
- I don’t have admin access to the GitHub repo, so I can’t create or configure GitHub webhooks.
- I also don’t want to expose Jenkins over the internet using tools like ngrok, serveo, or similar.
- I’d also prefer to avoid polling (e.g. using a cron or Git plugin with a schedule).
I’ve found that some Jenkins plugins can detect GitHub PRs, but many of them have reported security vulnerabilities, which makes them unsuitable in my case.
Is there a reliable way to detect GitHub Pull Requests and trigger a Jenkins build locally?