Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sweep: Replace GitHub Webhooks with GitLab equivalents using the Python-GitLab-API #88

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sweep-ai[bot]
Copy link

@sweep-ai sweep-ai bot commented Mar 28, 2024

PR Feedback (click)

  • 👍 Sweep Did Well
  • 👎 Sweep Needs Improvement

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 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.
  • Use the GitHub issues extension for creating Sweep issues directly from your editor.

💡 To get Sweep to edit this pull request, you can:

  • Comment below, and Sweep can edit the entire PR
  • Comment on a file, Sweep will only modify the commented file
  • Edit the original issue to get Sweep to recreate the PR from scratch

This is an automated message generated by Sweep AI.

Copy link
Author

sweep-ai bot commented Mar 28, 2024

Rollback Files For Sweep

  • Rollback changes to sweepai/handlers/on_comment.py
  • Rollback changes to sweepai/utils/gitlab_utils.py

This is an automated message generated by Sweep AI.

Copy link
Author

sweep-ai bot commented Mar 28, 2024

Apply Sweep Rules to your PR?

  • 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.

@sweep-ai sweep-ai bot added the sweep Sweep your software chores label Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sweep Sweep your software chores
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sweep: Replace GitHub Webhooks with GitLab equivalents using the Python-GitLab-API
1 participant