I am using webhooks to notify my Jenkins CI whenever a new push is sent.
When I created the Webhook , I checked the box “Just the push events”.
On Jenkins side I am using Generic Webhook Pluging and all is working fine.
However when a user merges a pull request and asks for deletion of the same branch while merging, I am also receiving an even for the branch deletion. This triggers my job, and of course it aborts as the branch that I am retrieving in the payload does not exist anymore.
How can I prevent that on Github side ?
If it’s not possible to do anything on Github side, which field in the payload of the event would allow me to distinguish a “Push” event from a “Branch deletion” event ? It seems that both payloads do not include the “action” field…
Hi there! Welcome to the Community!
Deleting a branch is considered a push event, but you should be able to differentiate by looking at the “deleted” field. Its value will be “true” if the event is from a branch or tag deletion, and “false” otherwise.