UploadFile
Enables users to upload files directly to a specified GitHub repository for collaborative purposes.
Sample
The 'Path' parameter is required, and must be relative to the repository root without a preceding '/'.
EXECUTE [Information].[UploadFile] Repository = 'HelloGit', Path = 'testFileUploadFromProcedure.txt', LocalPath = 'C:/Users/CData/Desktop/project/file.txt', CommitMessage = 'test'
EXECUTE [Information].[UploadFile] Repository = 'HelloGit', Path = 'src/Main.java', FileData = 'aGVsbG8gd29ybGQh', CommitMessage = 'test', Branch = 'master', CommitterName = 'CData', CommitterEmail = '[email protected]', AuthorName = 'CDataSupport', AuthorEmail = '[email protected]'
Set SHA to replace an existing file.
EXECUTE [UploadFile] Repository = 'HelloGit', Path = 'src/Main.java', FileData = 'aGVsbG8gd29ybGQh', CommitMessage = 'test', SHA = 'bc7774a7b18deb1d7bd0212d34246a9b1260ae17'
Input
| Name | Type | Description |
| Path | String | The file path relative to the repository root where the file will be uploaded. |
| Repository | String | The name of the repository where the file will be uploaded. |
| OwnerLogin | String | The login (username) of the owner of the repository. |
| Branch | String | The branch to which the file will be uploaded. Defaults to 'main' if not specified.
The default value is main. |
| CommitMessage | String | The commit message describing the changes made by the file upload. |
| SHA | String | The hash of the file, used to update existing files. Required if the file already exists. |
| CommitterName | String | The name of the person committing the file. Defaults to the authenticated user if not specified. |
| CommitterEmail | String | The email of the person committing the file. Defaults to the authenticated user if not specified. |
| AuthorName | String | The name of the author of the file upload. Defaults to the committer or the authenticated user if not specified. |
| AuthorEmail | String | The email of the author of the file upload. Defaults to the committer or the authenticated user if not specified. |
| LocalPath | String | The absolute file path on the local system from which the file data is read. |
| FileData | String | A Base64-encoded string representation of the file content. Used if both LocalPath and InputStream are not provided. |
Result Set Columns
| Name | Type | Description |
| Success | Boolean | Indicates whether the file upload operation was successful. |
| Details | String | Additional details about the execution of the file upload operation. |
| CommitSHA | String | The unique hash of the commit created by the file upload. |
| FileSHA | String | The unique hash of the uploaded file node. |