Adds type to issue webhook attributes
What does this MR do and why?
Contributes to Add (work item) type to issue events webhook (#467415 - closed) (&10150 (comment 1953253582) also contains a discussion about this approach)
Right now the issue events webhook triggers on updates for legacy issues, Service Desk issues, Incidents and all new work item types. But there's no way to tell which type a given work item is from the event payload.
this MR adds the type
attribute to object_attributes
of the request payload. type
contains the name of the work item type, which is always available, also for legacy issues.
This works for issue events and confidential issue events because we use the same lib/gitlab/hook_data/issue_builder.rb
for both events.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
- Open a project that has at least one issue.
- Navigate to
Settings
andWebhooks
and selectAdd new webhook
. - Fill fields:
- Use a public webhook listening service or build one on your own. For example, you can use a webhook URL generated by https://webhook.site/ and paste it into the webhook form. I think you could also use
https://example.com/
(untested). We'll look at the webhook logs in GitLab for this validation, so the URL doesn't really matter. - Add a name and add a secret token (e.g.
super-secret-token-42
). - Select
issues events
and deselectEnable SSL verification
(depending on your selected webhook URL)
- Use a public webhook listening service or build one on your own. For example, you can use a webhook URL generated by https://webhook.site/ and paste it into the webhook form. I think you could also use
- Select
Add webhook
. - Then select
edit
for the newly created webhook and scroll to the bottom of the page. - Expand the
Test
multiselect and selectIssues events
. This reloads the page. - At the bottom of the section
Recent events
you should see the test event. SelectView details
. - In the
Request
section you should findtype
underobject_attributes
(probably with the valueIssue
. - (Optional) If you want to double-check this, you can also create a task on that issue, get back to the webhook page and find the event for the created tasks. Here
type
should beTask
and the top-levelobject_kind
should bework_item
.