Wrapper for GitLab API.
GitLabAPIWrapper()The url of the GitLab instance.
The name of the GitLab repository, in the form {username}/{repo-name}.
Personal access token for the GitLab service, used for authentication.
The specific branch in the GitLab repository where the bot will make
its commits. Defaults to 'main'.
The base branch in the GitLab repository, used for comparisons.
Usually 'main' or 'master'. Defaults to 'main'.
Validate that api key and python package exists in environment.
Extracts title and number from each Issue and puts them in a dictionary Parameters: issues(List[Issue]): A list of gitlab Issue objects Returns: List[dict]: A dictionary of issue titles and numbers
Fetches all open issues from the repo
Fetches a specific issue and its first 10 comments
Parameters:
issue_number(int): The number for the gitlab issue
Returns:
dict containing the issue's title, body, and comments as a string
Makes a pull request from the bot's branch to the base branch Parameters: pr_query(str): a string which contains the PR title and the PR body. The title is the first line in the string, and the body are the rest of the string. For example, "Updated README made changes to add info" Returns: str: A success or failure message
Adds a comment to a gitlab issue Parameters: comment_query(str): a string which contains the issue number, two newlines, and the comment. for example: "1
Working on it now" adds the comment "working on it now" to issue 1 Returns: str: A success or failure message
Creates a new file on the gitlab repo Parameters: file_query(str): a string which contains the file path and the file contents. The file path is the first line in the string, and the contents are the rest of the string. For example, "hello_world.md
Returns:
str: A success or failure message
Reads a file from the gitlab repo Parameters: file_path(str): the file path Returns: str: The file decoded as a string
Updates a file with new content. Parameters: file_query(str): Contains the file path and the file contents. The old file contents is wrapped in OLD <<<< and >>>> OLD The new file contents is wrapped in NEW <<<< and >>>> NEW For example: test/hello.txt OLD <<<< Hello Earth! >>>> OLD NEW <<<< Hello Mars! >>>> NEW Returns: A success or failure message
Deletes a file from the repo Parameters: file_path(str): Where the file is Returns: str: Success or failure message
Get the list of files in the main branch of the repository
Get the list of files in the active branch of the repository
Get the list of files in the active branch of the repository from a specific directory
Create a new branch in the repository and set it as the active branch
Get the list of branches in the repository
Equivalent to git checkout branch_name for this Agent.
Clones formatting from Gitlab.
Returns an Error (as a string) if branch doesn't exist.