fix(gitlab): trigger when MR changes from draft to ready #1749
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
User description
It currently isn't retriggering when the MR goes from draft to ready. The main issue is in the
is_draft_ready
function which doesn't correctly handle the webhook data format coming from GitLab:The problem is that the function is comparing string values 'true' and 'false', but in the webhook data, the values are booleans. In my PR, it converts string values to boolean if needed for compatibility with different GitLab versions and uses strict type comparison (is True and is False) to ensure correct behavior.
PR Type
Bug fix
Description
Fixes detection of draft-to-ready state in GitLab MRs
Adds compatibility for both boolean and string webhook values
Ensures strict type comparison for draft status changes
Changes walkthrough 📝
gitlab_webhook.py
Improve MR draft-to-ready detection for GitLab webhooks
pr_agent/servers/gitlab_webhook.py
is_draft_ready
to handle both boolean and string values