Merge "gitlab: an "update" event isn't always a "labeled" action"

This commit is contained in:
Zuul 2020-09-28 22:55:17 +00:00 committed by Gerrit Code Review
commit e4a199e5eb
2 changed files with 8 additions and 8 deletions

View File

@ -1867,13 +1867,13 @@ class FakeGitlabMergeRequest(object):
'action': action
},
}
data['labels'] = [{'title': label} for label in self.labels]
data['changes'] = {}
if include_labels:
data['labels'] = [{'title': label} for label in self.labels]
data['changes'] = {
'labels': {
'previous': [],
'current': data['labels']
}
data['changes']['labels'] = {
'previous': [],
'current': data['labels']
}
return (name, data)

View File

@ -132,9 +132,9 @@ class GitlabEventConnector(threading.Thread):
event.action = 'opened'
elif attrs['action'] == 'merge':
event.action = 'merged'
elif attrs['action'] == 'update' and "labels" not in body:
elif attrs['action'] == 'update' and "labels" not in body["changes"]:
event.action = 'changed'
elif attrs['action'] == 'update' and "labels" in body:
elif attrs['action'] == 'update' and "labels" in body["changes"]:
event.action = 'labeled'
previous_labels = [
label["title"] for