Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-66821

Why are builds getting triggered when PR is closed?

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • Jenkins 2.303.1
      GitHub Branch Source 2.11.2

      We're setting up Jenkins to automatically build when new PRs are opened or updated. This is working great, but we've noticed that builds also happen when PRs are closed.

       

      Is this something we can disable? If a developer closes a PR, there's no need for us to waste any time doing a build.

       

      I believe this is the relevant code of the `github-branch-source-plugin` plugin: https://github.com/jenkinsci/github-branch-source-plugin/blob/923184ce70fc84252937b8d08872f666efcc288b/src/main/java/org/jenkinsci/plugins/github_branch_source/PullRequestGHEventSubscriber.java#L146-L154. Here you can see a `SCMEvent.Type.REMOVED` event getting fired. It's unclear to me what actually reacts to that event and triggers a build, though.

       

      Any help would be super appreciated. Thanks!

            Unassigned Unassigned
            jfly Jeremy Fleischman
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: