Add labels support to PR and MR creation tools (#9402)

Co-authored-by: openhands <openhands@all-hands.dev>
This commit is contained in:
Robert Brennan
2025-07-04 03:55:54 -04:00
committed by GitHub
parent ef502ccba8
commit 8af1f1cac9
3 changed files with 25 additions and 0 deletions

View File

@@ -462,6 +462,7 @@ class GitLabService(BaseGitService, GitService):
target_branch: str,
title: str,
description: str | None = None,
labels: list[str] | None = None,
) -> str:
"""
Creates a merge request in GitLab
@@ -472,6 +473,7 @@ class GitLabService(BaseGitService, GitService):
target_branch: The name of the branch you want the changes merged into
title: The title of the merge request (optional, defaults to a generic title)
description: The description of the merge request (optional)
labels: A list of labels to apply to the merge request (optional)
Returns:
- MR URL when successful
@@ -494,6 +496,10 @@ class GitLabService(BaseGitService, GitService):
'description': description,
}
# Add labels if provided
if labels and len(labels) > 0:
payload['labels'] = ','.join(labels)
# Make the POST request to create the MR
response, _ = await self._make_request(
url=url, params=payload, method=RequestMethod.POST