mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-04 21:00:40 +08:00
fix(gitlab): trigger when MR changes from draft to ready
This commit is contained in:
@ -86,9 +86,19 @@ def is_draft(data) -> bool:
|
|||||||
def is_draft_ready(data) -> bool:
|
def is_draft_ready(data) -> bool:
|
||||||
try:
|
try:
|
||||||
if 'draft' in data.get('changes', {}):
|
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
|
return True
|
||||||
|
|
||||||
# for gitlab server version before 16
|
# for gitlab server version before 16
|
||||||
elif 'title' in data.get('changes', {}):
|
elif 'title' in data.get('changes', {}):
|
||||||
if 'Draft:' in data['changes']['title']['previous'] and 'Draft:' not in data['changes']['title']['current']:
|
if 'Draft:' in data['changes']['title']['previous'] and 'Draft:' not in data['changes']['title']['current']:
|
||||||
|
Reference in New Issue
Block a user