repo:push events for creating a branch
Asked by Fiden Galvez:

Hi Atlassian:

Do we have any option to send events(repo:push) only when a developer do "git push"

Wright now i see that everytime i create a branch or I do a merge to some branch Bitbucket send repo:push.

How can i send only when developer does a "git push"??

Thank you in advance.


Answers:
author: Patrik S
body: Hello [@Fiden Galvez](/t5/user/viewprofilepage/user-id/5163029) ,

Welcome to Atlassian Community!

I assume you are referring to the webhook event ***repo:push***. This event is triggered whenever a git push happens to the repository - and this includes branch creation/deletion and merges.

When a branch is created or deleted, under the hood this also means that a git reference was pushed to your repository to either create or delete the branch reference. This is the reason why it triggers the repo:push webhook.

On the other hand, when you merge a pull request using the strategies ***merge commit*** or ***squash***, this will create a new commit with the merged change in the destination branch of the pull request. This is also considered a push of the merge commit, and hence it triggers the repo:push webhook.

That said, I'm afraid that there's not currently a way to filter only for events of git push a developer did from their local clone of the repository, because the other events mentioned above are also considered valid repository push events.

An option that I can think of if you want to filter out branch creation and deletion is to use the fields of the repo:push webhook payload to identify if the event was a branch creation or deletion. This would need to be implemented on the receiving end, and the fields of the payload you would need to look for would be "created" (**true** for the branch created event) and "closed" (**true** when the branch is deleted). You can learn more about all the fields available in the repo:push payload and their description in [Bitbucket Cloud Webhooks - Event Payloads:Push](https://support.atlassian.com/bitbucket-cloud/docs/event-payloads/#Push)

Hope that helps! Let me know in case you have any other questions.

Thank you, [@Fiden Galvez](/t5/user/viewprofilepage/user-id/5163029) !

Patrik S

comments: author: Fiden Galvez
body: Hi, Patrik

Thank you very much for your prompt response.  
In a way it helps somewhat, but I have to find a way to use those values ??to achieve the goal of CI continuous integration in the pipeline.  
I use Tekton with CEL interceptor to filter these fields and only trigger when there is merge and not when part of the merge triggers other push events.  
If you have some information or examples of how to do it with CEL filters, I would greatly appreciate it.


author: Patrik S
body: Hello [@Fiden Galvez](/t5/user/viewprofilepage/user-id/5163029) ,

I was not able to find an example using Tekton with Cel interceptor and to be honest, I haven't personally used this tool yet. In this case, I would suggest analyzing the examples provided in [Tekton's official documentation](https://tekton.dev/docs/triggers/cel_expressions/) on how to process JSON files, as the Bitbucket webhook is sent in JSON format (see the [bitbucket webhook payload](https://support.atlassian.com/bitbucket-cloud/docs/event-payloads/)).

Thank you, [@Fiden Galvez](/t5/user/viewprofilepage/user-id/5163029) !

Patrik S


Tags: bitbucket-cloud

cloud