jenkinsci / jenkinsci/github-branch-source-plugin

[JENKINS-66821] Why are builds getting triggered when PR is closed?

Open
#1,379 0 comments 0 reactions 0 assignees View on GitHub
component:github-branch-source-plugin imported-jira-issue priority:minor resolution:unresolved
Dominant language
Java
Stars
217
Forks
398
Avg merge
30m
Merged PRs (30d)
1

Description

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!

---
Originally reported by jfly, imported from: Why are builds getting triggered when PR is closed?


  • status: Open
  • priority: Minor
  • component(s): github-branch-source-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 2
  • imported: 2025-12-02

Raw content of original issue

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!

environment

```
Jenkins 2.303.1

GitHub Branch Source 2.11.2
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.