I am using the pr:modified event in my webhook order to ensure that the required reviewers I want to add to a certain pull request. I am currently using the PUT method on the /pullrequests/{pullRequestId} endpoint to perform the same. But this API in turn modifies the PR and triggers a pr:modified event yet again which makes my webhook being called in a loop. Can someone please let me know how we can instead make the pr:reviewer:updated event occur when updating reviewers via REST API?
The pr:updated
event should only be sent if the PR title, description or target have changed? Your reviewer PUT operation does not modify these fields?
The pr:reviewer:updated
event should be triggered if reviewers are updated and above values have not changed.
In my little test both pr:reviewer:updated
and pr:modified
are triggered with identical timestamps when adding a reviewer.
That should not happen. You should file a bug report with Atlassian support.
On a pragmatic side (ie don’t hold you breath while waiting for a bug fix) I would compare the timestamp of both event payloads and if equal, ignore the pr:modfied
event in this case.
Let me know how you go! Cheers Ulrich
// Izymes
Hi @UlrichKuhnhardtIzym1
Thanks for updating. I actually didn’t notice both the events are triggered. Thanks for pointing that out.
But nevertheless since each event will call the webhook individually and since each run of my function will be separate, my code will not be aware that there exists another event of type pr:reviewer:updated with the same timestamp.
I wish there was some way to tag the reviewer update operation as well so that I could identify that the pr:modified event was triggered due to my operation
Ideally I believe there should be separate endpoint for updating reviewers. And calling that endpoint should only trigger the pr:reviewers:updated event and nothing else.
Thanks anyway