jenkinsci / jenkinsci/github-branch-source-plugin
[JENKINS-56111] closing a PR does not trigger a pipeline build
- Dominant language
- Java
- Stars
- 217
- Forks
- 398
- Avg merge
- 30m
- Merged PRs (30d)
- 1
Description
I use the GitHub Branch Source Plugin for my multi-branch pipeline. In my use case I want to do some cleanup steps when the pr is closed, e.g. deleting PR related cache files. My current understanding is that a build should be triggered if the state of the PR is changed including a close event. But for me this doesn't work. When reopen the PR a build will be triggered correctly identifying the state as being reopened. In the configuration I couldn't find any specific trigger for closing a PR.
To reproduce:
Make a new PR from fork or origin -> pipeline build is triggered
Close PR -> nothing happens [but it should notify something?]
Reopen PR -> pipeline build is triggered
My workaround would be to regularly fetch all open PRs from GitHub and compare with the cache directories (PR specific) to manually invoke the cleanup, but it would be much cleaner to keep the logic within the scope of the respective PR.
I am probably just missing something here but any help is really appreciated.
---
Originally reported by rahn, imported from: closing a PR does not trigger a pipeline build
Raw content of original issue
I use the GitHub Branch Source Plugin for my multi-branch pipeline. In my use case I want to do some cleanup steps when the pr is closed, e.g. deleting PR related cache files. My current understanding is that a build should be triggered if the state of the PR is changed including a close event. But for me this doesn't work. When reopen the PR a build will be triggered correctly identifying the state as being reopened. In the configuration I couldn't find any specific trigger for closing a PR.
To reproduce:
Make a new PR from fork or origin -> pipeline build is triggered
Close PR -> nothing happens [but it should notify something?]
Reopen PR -> pipeline build is triggered
My workaround would be to regularly fetch all open PRs from GitHub and compare with the cache directories (PR specific) to manually invoke the cleanup, but it would be much cleaner to keep the logic within the scope of the respective PR.
I am probably just missing something here but any help is really appreciated.
environment
```
Jenkins 2.138.3 - amd64 4.4.0-138-generic
github-branch-source 2.4.2
github 1.29.3
github-api 1.92
github-branch-source 2.4.2
github-oauth 0.29
github-organization-folder 1.6
github-pullrequest 0.2.4
pipeline-build-step 2.7
pipeline-github 2.1
pipeline-github-lib 1.0
pipeline-graph-analysis 1.7
pipeline-input-step 2.8
pipeline-milestone-step 1.3.1
pipeline-model-api 1.3.2
pipeline-model-declarative-agent 1.1.1
pipeline-model-definition 1.3.2
pipeline-model-extensions 1.3.2
pipeline-rest-api 2.10
pipeline-stage-step 2.3
pipeline-stage-tags-metadata 1.3.2
pipeline-stage-view 2.10
plain-credentials 1.4
```
Contributor guide
Assessment
This issue has not been assessed yet.