title: GitHub WebHooks triggered globally instead of per branch
body: <p>Our product creates WebHooks at GitHub. One for each customer project. </p>
  
  <p>Each such project, is linked to a single branch.</p>
  
  <p>When a <code>push</code> to GitHub is performed, the corresponding WebHook is triggered, which in its turn, is making a request to an endpoint on our side to perform a certain action.</p>
  
  <p>A common scenario is that a customer would have several projects, connected to several different branches of the same repository. Hence, several different WebHooks are connected to the same repository.</p>
  
  <p>The problem is that when a <code>push</code> is performed to one of the branches, GitHub triggers all repository related WebHooks.</p>
  
  <p>We would expect that when a push is made to a certain branch, only a single corresponding WebHook would be triggered.</p>
  
  <p>I found two posts (one of them is from 2012) that seem to refer to this problem:</p>
  
  <ul>
  <li><a href="http://Web%20Hooks%20-%20execute%20only%20for%20specified%20branches" rel="noreferrer">Web Hooks - execute only for specified branches</a></li>
  <li><a href="https://github.com/gogits/gogs/issues/4105" rel="noreferrer">Ability to select a specific branch in webhook</a></li>
  </ul>
  
  <p>A possible solution would be to parse the <code>ref</code> parameter sent inside the webhook request and control when to take action accordingly (haven't checked that direction yet, and hope <code>ref</code> indeed always exists and holds the right branch path/name). But that will be "too late" - cause all WebHooks will have been triggered by then...</p>
  
  <p>But seems unreasonable that GitHub wouldn't have a way to configure this behavior somehow.</p>
  
  <p>Help would be appreciated.</p>