MR webhook filtering by branch (source/target)

Problem to solve

Currently, GitLab merge request webhooks do not support filtering by branch names. This means that webhook events are triggered for all merge requests regardless of which branches are involved (source or target). Users must receive all MR webhook events and then filter them on the consumer side based on object_attributes.source_branch or object_attributes.target_branch fields in the payload.

Proposal

Add branch filtering capabilities to merge request webhook configurations, similar to the filtering available for push events. Users should be able to specify:

  • Source branch patterns (e.g., feature/*, main, develop)
  • Target branch patterns (e.g., main, release/*)
  • Combination filters (e.g., only MRs from feature/* to main)

This would allow users to configure webhooks that only trigger for merge requests involving specific branches, reducing unnecessary webhook traffic and simplifying webhook consumer logic.