3

Right now using the webhook pull request updated event I get notified for any pull request update (eg: description updated, title changed, etc.)

Is there a way to be notified only when a push was made to a pull request?

daniels
  • 18,416
  • 31
  • 103
  • 173

1 Answers1

2

No, the webhook will be triggered each time something changes in a pull request.

However, looking at the payload that you will get with a pullrequest:updated webhook, you could build that logic yourself, by comparing the source commit hash with a previously (stored) hash. If they are different, it means that a push was made.

Payload snippet:

{
   "id" :  1 ,
   "title" :  "Title of pull request" ,
   "description" :  "Description of pull request" ,
   "state" :  "OPEN|MERGED|DECLINED" ,
   "author" : User,
   "source" : {
    "branch" : {  "name" :  "branch2" },
    "commit" : {  "hash" :  "d3022fc0ca3d" },
    "repository" : Repository
   }
}
Alexandru Guzinschi
  • 5,675
  • 1
  • 29
  • 40
  • 1
    Yes, that's what I ended up doing. I cache this hash in Redis for 7 days and update the hash/expiration time when the PR is pushed/updated. I was hoping for something nicer... if only BB would've just had a extra param in there "is_push" or something... Their API is way behind GitHub. – daniels Aug 16 '15 at 18:57