'Ref Spec for Branch Sources in Jenkins Job to build PR and branch

I have Jenkins server integrated with Github and sonarqube.

Now I want to use sonarqube to scan my develop branch and pull request (Only which is submitted to develop branch).

so I config the Ref Spec like this:

+refs/heads/develop:refs/remotes/origin/develop

Discover branches Exclude branches that are also filed as PRs

now I find that when a Pull request is submited to developer branch, it will trigger jenkins build, and also the developer branch, but the feature branch also trigger the jenkins job. So how I should write the Ref Spec? Can anyone help me! Thank you!

jenkins screenshot jenkins job config



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source