Add missing fields in Webhook events when using Test button

Summary

The payload for Webhook events are not consistent when using:

  • actual event as trigger
  • Test button as trigger

For the latter scenario, some fields like action are missing which might cause issues with the receiving application.

Steps to reproduce

  1. Create a new project.
  2. Create a Webhook and select Merge request events as the `Trigger.
  3. Create a dummy MR and observe a webhook event is created.
  4. Use the Test button in the webhook settings and observe another event is created.

Example Project

https://gitlab.com/kballon-bug-report/zd540601_webhook_action/-/hooks

What is the current bug behavior?

  1. The action field is missing from the payload.

What is the expected correct behavior?

  1. The action should be included in the payload.

Relevant logs and/or screenshots

example_test_button.json

example_mr.json

Output of checks

This bug happens on GitLab.com

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes