# GitHub Integration Tool The GitHub Integration Tool provides a simple interface to interact with the GitHub repository for the Cyclop project. This tool allows reading files, creating branches, committing changes, and creating pull requests. ## Functions The tool provides the following functions: 1. `read_file`: Read a file from the repository 2. `create_branch`: Create a new branch in the repository 3. `commit_file`: Commit a file to a branch (not main) 4. `create_pull_request`: Create a pull request ## Usage To use this tool, you need to have the `GITHUB_TOKEN` environment variable set with your GitHub personal access token. ### Read File Reads the content of a file from the repository. Parameters: - `path`: The path to the file in the repository Example: ``‍`python result = github_tool.execute("read_file", path="README.md") print(result) # Prints the content of README.md ``‍` ### Create Branch Creates a new branch in the repository. Parameters: - `branch_name`: Name of the new branch - `base_branch` (optional): Name of the base branch (default is "main") Example: ``‍`python result = github_tool.execute("create_branch", branch_name="feature-branch") print(result) # Prints a success message if the branch was created ``‍` ### Commit File Commits a file to a specified branch (not main). Parameters: - `branch_name`: Name of the branch to commit to - `file_path`: Path to the file in the repository - `content`: Content of the file - `commit_message`: Commit message Example: ``‍`python result = github_tool.execute( "commit_file", branch_name="feature-branch", file_path="docs/NEW_FEATURE.md", content="# New Feature\n\nThis document describes the new feature.", commit_message="Add documentation for new feature" ) print(result) # Prints a success message if the file was committed ``‍` ### Create Pull Request Creates a pull request from one branch to another. Parameters: - `title`: Title of the pull request - `body`: Body of the pull request - `head`: The name of the branch where your changes are implemented - `base` (optional): The name of the branch you want the changes pulled into (default is "main") Example: ``‍`python result = github_tool.execute( "create_pull_request", title="Add new feature documentation", body="This PR adds documentation for the new feature.", head="feature-branch" ) print(result) # Prints the URL of the created pull request ``‍` ## Error Handling If an error occurs during the execution of any function, an error message will be returned instead of the expected result. Always check the returned value to ensure the operation was successful. ## Notes - This tool uses the GitHub API v3. - Make sure your GitHub token has the necessary permissions to perform these operations. - Committing directly to the main branch is not allowed for safety reasons.