Actions36
- File Actions
- Issue Actions
- Organization Actions
- Release Actions
- Repository Actions
- Review Actions
- User Actions
- Workflow Actions
File → Create
AI-generatedOverview
This node operation creates a new file in a specified GitHub repository using GitHub App authentication. It supports uploading file content either as text or binary data, specifying the file path, commit message, and optional additional parameters such as author, committer, and branch. This operation is useful for automating file creation in repositories, such as adding documentation, configuration files, or code snippets programmatically.
Use Case Examples
- Automatically create a README.md file in a GitHub repository with predefined content.
- Upload a binary file (e.g., an image or compiled asset) to a repository branch.
- Commit a new configuration file to a specific branch with a custom commit message and author information.
Properties
| Name | Meaning |
|---|---|
| Repository Owner | The owner of the GitHub repository where the file will be created. Can be selected from a list, provided as a URL, or entered by name. |
| Repository Name | The name of the GitHub repository where the file will be created. Can be selected from a list, provided as a URL, or entered by name. |
| File Path | The full path of the file to create in the repository, including directories and filename. |
| Binary File | Whether the file content to upload should be taken from a binary input field instead of text content. |
| File Content | The text content of the file to create. Used only if Binary File is false. |
| Input Binary Field | The name of the input binary field containing the file data to upload. Used only if Binary File is true. |
| Commit Message | The commit message to use for the file creation commit. |
| Additional Parameters | Optional additional parameters for the commit, including author, committer, and branch information. |
Output
JSON
content- Details of the created file content returned from GitHub API, including file metadata and commit information.
Dependencies
- GitHub App API authentication with credentials including app ID, installation ID, and private key.
Troubleshooting
- Ensure the repository owner and repository name are correctly specified and accessible by the GitHub App installation.
- If uploading binary data, verify the binary input field name matches the actual binary data field in the input.
- Commit message is required; ensure it is provided to avoid errors.
- If editing an existing file, the SHA of the file must be correctly retrieved to avoid conflicts.
- Check branch name if specified; if the branch does not exist or is misspelled, the operation will fail.
Links
- GitHub API - Create or Update File Contents - Official GitHub API documentation for creating or updating files in a repository.