Merge Request events webhook shows changes that did not happen
Summary
I am maintaining a slack-gitlab integration. I have a Merge Request event webhook configured for my project. Every time I push a commit to a branch that has a Merge Request opened, the Merge Request event body shows things under changes
that did not actually change (labels and assignees). Is this a bug or is it the expected behaviour?
In particular, I am interested in the assignees
field, as I need to send a slack notification when someone get a Merge Request assigned. This works fine when the assignee changes, but is not useful because it also triggers when a commit is pushed to the repository (without assignee actually changing).
This is the relevant json subtree (changes
field) I am getting on every commit pushed:
{
"updated_at": { ... },
"assignees": {
"previous": [],
"current": [
{
"name": "me",
"username": "meme",
"avatar_url": "https://secure.gravatar.com/avatar/me",
"email": "me@me.me"
}
]
},
"labels": { ... },
"total_time_spent": { ... }
}
I would expect changes
to hold only things that actually changed. I did not find another way of identifying when someone gets assigned a Merge Request.
Steps to reproduce
- Start a new project.
- Configure a Merge request events webhook.
- Checkout a new branch and open a Merge Request for it.
- Assign yourself to the Merge Request.
- Push commits to the branch.
Example Project
const express = require('express')
const app = express()
app.use(express.json())
app.post(
'/',
(req, res) => console.log(req.body.changes)
)
What is the current bug behavior?
Event webhook shows changes (req.body.changes.assignees
) on every commit pushed.
What is the expected correct behavior?
Event webhook assignees changes (req.body.changes.assignees
) is empty if an assignee change did not occur.
Output of checks
This bug happens on a self-hosted gitlab.
Gitlab version
GitLab Community Edition 12.9.2