This pull request introduces changes to the sweepai project to support GitLab by replacing GitHub Webhooks with GitLab equivalents using the Python-GitLab API. The modifications include the adaptation of the on_comment handler to process GitLab merge requests (MRs) and updates to the gitlab_utils module to utilize OAuth tokens for authentication with the GitLab API.
Summary
Updated on_comment.py to handle GitLab merge requests:
Added logic to authenticate with GitLab using an OAuth token.
Extracted project ID and MR ID from the provided path to fetch MR details and comments.
Placeholder added for further adaptation of logic to process GitLab MR comments.
Modified gitlab_utils.py to support OAuth token authentication:
Changed the get_gitlab_client function to accept an OAuth token for GitLab API authentication.
Updated get_mr_comments, get_mr_details, and post_mr_comment functions to use the modified get_gitlab_client method, ensuring they authenticate with the correct token.
Adjusted function calls and parameters to align with the OAuth token usage instead of private tokens.
Fixes #87.
🎉 Latest improvements to Sweep:
New dashboard launched for real-time tracking of Sweep issues, covering all stages from search to coding.
Integration of OpenAI's latest Assistant API for more efficient and reliable code planning and editing, improving speed by 3x.
[ ] Apply: We should use loguru for error logging. If the log is inside an exception, use logger.exception to add tracebacks, where logger is imported from loguru. Use f-strings for string formatting in logger calls (e.g. logger.info(f'Hello {name}') instead of logger.info('Hello {name}', name=name)).
[ ] Apply: There should be no debug log or print statements in production code.
[ ] Apply: All functions should have parameters and output annotated with type hints. Use list, tuple and dict instead of typing.List, typing.Tuple and typing.dict.
[ ] Apply: Leftover TODOs in the code should be handled.
[ ] Apply: All new business logic should have corresponding unit tests in the same directory. For example, sweepai/api_test.py tests sweepai/api.py. Use unittest and unittest.mock as required.
[ ] Apply: Any clearly inefficient or repeated code should be optimized or refactored.
[ ] Apply: Remove any comments before code that are obvious. For example # this prints hello world; print('hello world').
This is an automated message generated by Sweep AI.
PR Feedback (click)
Description
This pull request introduces changes to the
sweepai
project to support GitLab by replacing GitHub Webhooks with GitLab equivalents using the Python-GitLab API. The modifications include the adaptation of theon_comment
handler to process GitLab merge requests (MRs) and updates to thegitlab_utils
module to utilize OAuth tokens for authentication with the GitLab API.Summary
on_comment.py
to handle GitLab merge requests:gitlab_utils.py
to support OAuth token authentication:get_gitlab_client
function to accept an OAuth token for GitLab API authentication.get_mr_comments
,get_mr_details
, andpost_mr_comment
functions to use the modifiedget_gitlab_client
method, ensuring they authenticate with the correct token.Fixes #87.
🎉 Latest improvements to Sweep:
💡 To get Sweep to edit this pull request, you can:
This is an automated message generated by Sweep AI.