Hi!
I have set up webooks for the "repo:push" and "pullrequest:updated" events. (Other "pullrequest" events too, but not relevant to the question I think).
I want to act on the update of a pull request by checking the commit(s) in various ways. Both the "repo:push" and "pullrequest:updated" events are sent off when a pull request is updated, but only the "repo:push" event contains information about the old value of the updated ref. The two events seem to always be delievered in separate payloads.
Is there a way to "tie" these two events together? For example, is one guaranteed to be delivered before the other? Or is there some ID in the payloads that are the same? From what I can see "repo:push" is always delivered first, but I'm not sure if that's reliable.
Thanks!
Hello @Øystein Walle and thank you for reaching out to Community!
The webhooks for different events are indeed sent in different payloads.
I would not rely on the order of the delivery to link the payload of both the events together, as they are separate requests, and Bitbucket will attempt to send each webhook 3 times, it's not always granted that one event will be delivered before the other.
In your case, as you want to link the payload of a repo:push with a pullrequest:updated, I would suggest checking the commit hash in each of the payloads.
In the pullrequest:updated you will have the head commit of the source branch in the pullrequest.source.commit.hash field. This can be compared with the push.changes.new.target.hash field of the repo:push event, as it will contain the commit that triggered the event.
You could use the commit hashes as described above to link the content of each payload and get the information you are looking for.
For additional details on the webhook payload of each event, the following documentation may also be of help :
Thank you, @Øystein Walle !
Patrik S
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.