如果在 GitHub 上提出 PR,则自动触发 Jenkins Multibranch Pipeline

Triggering Jenkins Multibranch Pipeline automatically if a PR is raised on GitHub

我正在使用 Jenkins Multibranch 管道。 我已经在 GitHub 上配置了 API(github-webhook 和 ghprbhook)。 目前,如果我在 Jenkins 中单击 "Scan Repository Now/Scan Repository Log",如果 GitHub 上有任何 PR,Jenkins 将通过 GitHub 并在 Jenkins 中创建一个新的 PR 作业。 因此,每当在 GitHub 上提出合并请求时,我都需要触发此多分支管道。我希望此管道在 GitHub 上有 PR 时自动触发。 我需要做什么才能实现这种方法? 是否可以在 GitHub 上提出 PR 时自动触发多分支管道?

你用过GitHub pull request builder plugin吗?

This Jenkins plugin builds pull requests from GitHub and will report the results directly to the pull request via the GitHub Commit Status API

When a new pull request is opened in the project and the author of the pull request isn't whitelisted, builder will ask Can one of the admins verify this patch?. One of the admins can comment ok to test to accept this pull request for testing, test this please for one time test run and add to whitelist to add the author to the whitelist.

If an author of a pull request is whitelisted, adding a new pull request or new commit to an existing pull request will start a new build.

A new build can also be started with a comment: retest this please.

为此,我只选择了 GitHub Webhooks 的 "Let me select individual events" 部分下的 "Push and Pull Request"。

PS: GitHub 分支在 Jenkins 中自动检测。