diff --git a/pr_agent/servers/gitlab_webhook.py b/pr_agent/servers/gitlab_webhook.py index 0aef933d..7a753c9e 100644 --- a/pr_agent/servers/gitlab_webhook.py +++ b/pr_agent/servers/gitlab_webhook.py @@ -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']: