File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed
src/codegen/extensions/langchain Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change 11"""Langchain tools for workspace operations."""
22
33import json
4+ import uuid
45from typing import ClassVar , Literal , Optional
56
67from langchain .tools import BaseTool
@@ -355,6 +356,9 @@ def __init__(self, codebase: Codebase) -> None:
355356 super ().__init__ (codebase = codebase )
356357
357358 def _run (self , title : str , body : str ) -> str :
359+ if self .codebase ._op .git_cli .active_branch .name == self .codebase ._op .default_branch :
360+ # If the current checked out branch is the default branch, checkout onto a new branch
361+ self .codebase .checkout (branch = f"{ uuid .uuid4 ()} " , create_if_missing = True )
358362 pr = self .codebase .create_pr (title = title , body = body )
359363 return pr .html_url
360364
You can’t perform that action at this time.
0 commit comments