Sweep: update SweepAI api.py and github-utils.py to provide methods/endpoints for calling GitLab issue, pipeline, and MR APIs in place of GitHub issues, PRs and actions. Also ensure that any webhooks are pointed to GitLab as well #24
This pull request updates the api.py and github_utils.py files in the sweepai directory to provide methods and endpoints for calling GitLab issue, pipeline, and merge request APIs instead of GitHub issues, pull requests, and actions. It also ensures that any webhooks are pointed to GitLab.
Summary
Updated api.py:
Imported sweepai.gitlab_utils
Changed the route decorator for the /webhook/gitlab endpoint to @app.post
Modified the handle_gitlab_issue_webhook function to check for both "Merge Request Hook" and "Issue Hook" events
Updated the progress function to use the get_gitlab_merge_request function from sweepai.gitlab_utils
Added github_utils.py:
Imported sweepai.gitlab_utils
Added functions get_issue, create_merge_request, and update_pipeline that call the corresponding GitLab APIs using sweepai.gitlab_utils
Added gitlab_utils.py:
Added functions get_gitlab_issue, create_gitlab_merge_request, and update_gitlab_pipeline that make requests to the GitLab API using the appropriate endpoints and headers
Fixes #19.
π Latest improvements to Sweep:
We just released a dashboard to track Sweep's progress on your issue in real-time, showing every stage of the process β from search to planning and coding.
Sweep uses OpenAI's latest Assistant API to plan code changes and modify code! This is 3x faster and significantly more reliable as it allows Sweep to edit code and validate the changes in tight iterations, the same way as a human would.
[ ] 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.
[ ] 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').
PR Feedback (click)
Description
This pull request updates the
api.py
andgithub_utils.py
files in thesweepai
directory to provide methods and endpoints for calling GitLab issue, pipeline, and merge request APIs instead of GitHub issues, pull requests, and actions. It also ensures that any webhooks are pointed to GitLab.Summary
Updated
api.py
:sweepai.gitlab_utils
/webhook/gitlab
endpoint to@app.post
handle_gitlab_issue_webhook
function to check for both "Merge Request Hook" and "Issue Hook" eventsprogress
function to use theget_gitlab_merge_request
function fromsweepai.gitlab_utils
Added
github_utils.py
:sweepai.gitlab_utils
get_issue
,create_merge_request
, andupdate_pipeline
that call the corresponding GitLab APIs usingsweepai.gitlab_utils
Added
gitlab_utils.py
:get_gitlab_issue
,create_gitlab_merge_request
, andupdate_gitlab_pipeline
that make requests to the GitLab API using the appropriate endpoints and headersFixes #19.
π Latest improvements to Sweep:
π‘ To get Sweep to edit this pull request, you can: