Adding scoped labels via the API does not always remove existing scoped labels
In release-tools!861 (merged) we are fixing an issue with our release tooling related to scoped labels. When a merge request is deployed, we add a certain workflow label to the merge request (e.g. workflowproduction) and expect existing workflow labels to be removed. The only way of doing this using the API is to:
- Get a merge request and its existing labels
- Add the new label to this list
- Submit an API request to update the merge request to use this new list of labels
Sometimes this worked, but other times it would not add the new label and remove the old one, instead keeping the list of labels as-is. This means that we have to manually filter out the old scoped label.
Using slash commands is not a viable alternative either, since the API produces an error when creating a comment that is just a slash command (see !19624 (merged)).