diff --git a/tools/github_tool_functions/get_current_branch.py b/tools/github_tool_functions/get_current_branch.py new file mode 100644 index 0000000..18c3139 --- /dev/null +++ b/tools/github_tool_functions/get_current_branch.py @@ -0,0 +1,37 @@ +import logging + +class GetCurrentBranch: + def __init__(self, current_branch): + self.current_branch = current_branch + + # Set up logging + self.logger = logging.getLogger(__name__) + self.logger.setLevel(logging.INFO) + + # Create a file handler + file_handler = logging.FileHandler('get_current_branch.log') + file_handler.setLevel(logging.INFO) + + # Create a console handler + console_handler = logging.StreamHandler() + console_handler.setLevel(logging.INFO) + + # Create a formatting for the logs + formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') + file_handler.setFormatter(formatter) + console_handler.setFormatter(formatter) + + # Add the handlers to the logger + self.logger.addHandler(file_handler) + self.logger.addHandler(console_handler) + + def __call__(self): + self.logger.info(f"Getting current branch: {self.current_branch}") + return self.current_branch + +# JSON definition for the get_current_branch function +get_current_branch_definition = { + "name": "get_current_branch", + "description": "Get the name of the current branch", + "parameters": {} +} \ No newline at end of file