GitHub Branch Source Plugin --> only scan for Pull Requests GitHub Branch Source Plugin --> only scan for Pull Requests jenkins jenkins

GitHub Branch Source Plugin --> only scan for Pull Requests


You can configure this in the job via the checkout behaviors. Just delete the Discover Branches item and it should not find any branches.enter image description here


Using JCaSC / DSL syntax it can be configured using gitHubBranchDiscovery trait with strategyId(1):

              branchSource {                  source {                      github {                          id('ci') // IMPORTANT: use a constant and unique identifier                          repositoryUrl('https://github.com/OWNER/REPO')                          repository('REPO')                          repoOwner('OWNER')                          apiUri('https://github.com/api/v3')                          configuredByUrl(false)                          credentialsId('github-token')                          traits {                              gitHubBranchDiscovery {                                  // 1 = Exclude branches that are also filed as PRs                                  // 2 = Only branches that are also filed as PRs                                  // 3 = All branches                                  strategyId(1)                              }                              gitHubPullRequestDiscovery {                                  // 1 = only PR merge                                  // 2 = only PR head                                  // 3 = both PR head and PR merge                                  strategyId(3) // 3 = both PR head and PR merge from origin                              }                          }                      }                  }              }