Create or update file
The "Create or Update File" GitHub tool empowers developers to remotely manage files within their repositories with ease. It simplifies the process of creating new files or updating existing ones by handling all operations directly via GitHub API calls, eliminating the need for local file handling.
Features
- Seamlessly create new files or update existing files in any branch of a GitHub repository.
- Supports updating files by requiring the SHA of the existing file to ensure safe overwrite operations.
- Allows specifying commit messages to maintain clear version history and change tracking.
- Works remotely via GitHub API, eliminating the need for local file system access or git commands.
- Supports operations on repositories owned by individual users or organizations, providing flexible integration possibilities.
Benefits
- Streamlines file management workflows by enabling remote operations directly from your tools or scripts.
- Ensures safe updates by requiring SHA, preventing accidental overwrites and maintaining data integrity.
- Enhances collaboration by integrating easily with CI/CD pipelines and automation tools.
- Saves time and resources by eliminating manual git command usage and local cloning.
- Improves project maintainability with clear and customizable commit messages for file changes.
Description
Create or update a single file in a GitHub repository. If updating, you must provide the SHA of the file you want to update. Use this tool to create or update a file in a GitHub repository remotely; do not use it for local file operations.
Parameters
7 parameters
| Name | Type | Description |
|---|---|---|
| branchrequired | string | Branch to create/update the file in |
| contentrequired | string | Content of the file |
| messagerequired | string | Commit message |
| ownerrequired | string | Repository owner (username or organization) |
| pathrequired | string | Path where to create/update the file |
| reporequired | string | Repository name |
| sha | string | Required if updating an existing file. The blob SHA of the file being replaced. |