- Notifications
You must be signed in to change notification settings - Fork673
Closed
Labels
Description
Before 1.0.0 I was updating attributes with the v4 API on both merge requests and hooks and able to save them correctly as the manager recognized I had modified them and was sending the updates to the API. But after 1.0.0 it appears the UpdateMixin (I assume, not familiar with this code) doesn't recognize changes any longer, which will cause thesave()
calls to fail when Gitlab returns a 400 because it wasn't actually asked to change anything.
Here's what my code looked like before
ifnothas_valid_changelog:self.log.info(f"Adding CHANGELOG label to{merge_req.web_url}")if'CHANGELOG'inmerge_req.labels:self.log.info(f"MR{merge_req.web_url} is already tagged with CHANGELOG label")returnmerge_req.labels.append('CHANGELOG')merge_req.save()
And after
ifnothas_valid_changelog:self.log.info(f"Adding CHANGELOG label to{merge_req.web_url}")if'CHANGELOG'inmerge_req.labels:self.log.info(f"MR{merge_req.web_url} is already tagged with CHANGELOG label")returnmerge_req.labels.append('CHANGELOG')# Need to stringize, since this doesn't go through the usual routesetattr(merge_req,'labels',','.join(merge_req.labels))merge_req.save()