Include branch name in Merge Request Webhook Event
Problem to solve
When a pipeline event is created from a merge request the payload no longer includes the specifics branch name. it appears this is a result of the changes made to merge requests here:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/25504
Currently Payload Example:
{
"object_kind": "pipeline",
"object_attributes": {
"id": 5,
"ref": "refs/merge-requests/15/head",
Prior payload example:
{
"object_kind": "pipeline",
"object_attributes": {
"id": 5,
"ref": "branch-name",
Proposal
Include the branch name as a property in the payload.
{
"object_kind": "pipeline",
"object_attributes":{
"id": 5,
"ref": "refs/merge-requests/15/head",
"branch": "branch-name"
Documentation
https://docs.gitlab.com/ee/user/project/integrations/webhooks.html#pipeline-events
{
"object_kind": "pipeline",
"object_attributes":{
"id": 31,
"ref": "master",
https://docs.gitlab.com/ee/ci/merge_request_pipelines/
Note: As of GitLab 11.10, pipelines for merge requests require GitLab Runner 11.9 or higher due to the recent refspecs changes. Anything lower will cause the pipeline to fail.