fix(gitlab): trigger when MR changes from draft to ready

This commit is contained in:
Simon Stamm
2025-05-08 12:50:54 +02:00
parent 4a8722acd5
commit 38f00386b4

View File

@ -86,9 +86,19 @@ def is_draft(data) -> bool:
def is_draft_ready(data) -> bool:
try:
if 'draft' in data.get('changes', {}):
if data['changes']['draft']['previous'] == 'true' and data['changes']['draft']['current'] == 'false':
# Handle both boolean values and string values for compatibility
previous = data['changes']['draft']['previous']
current = data['changes']['draft']['current']
# Convert to boolean if they're strings
if isinstance(previous, str):
previous = previous.lower() == 'true'
if isinstance(current, str):
current = current.lower() == 'true'
if previous is True and current is False:
return True
# for gitlab server version before 16
elif 'title' in data.get('changes', {}):
if 'Draft:' in data['changes']['title']['previous'] and 'Draft:' not in data['changes']['title']['current']: