GitHub App icon

GitHub App

Consume GitHub API using GitHub App authentication

File → Edit

AI-generated

Overview

This node operation allows editing a file in a GitHub repository using the GitHub API with GitHub App authentication. It supports specifying the repository owner, repository name, file path, and commit message. Users can edit the file content either by providing text content or by uploading binary data from a specified binary input field. Additional parameters such as author, committer, and branch can also be set. This operation is useful for automating updates to files in GitHub repositories, such as updating documentation, configuration files, or code files programmatically.

Use Case Examples

  1. Automatically update a README.md file in a GitHub repository with new documentation content.
  2. Edit a configuration file in a repository by uploading a new binary file version.
  3. Commit changes to a file on 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 resides. Can be selected from a list, provided as a URL, or entered by name.
Repository Name The name of the GitHub repository containing the file. Can be selected from a list, provided as a URL, or entered by name.
File Path The full path of the file in the repository to edit.
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 be uploaded when not using binary data.
Input Binary Field The name of the input binary field containing the file data to upload when using binary data.
Commit Message The commit message to use for the file edit commit.
Additional Parameters Additional optional parameters such as author, committer, and branch information for the commit.

Output

JSON

  • content - Base64 encoded content of the file after edit (from GitHub API response).
  • path - The file path of the edited file.
  • sha - The SHA hash of the file after the edit.
  • commitMessage - The commit message used for the edit.

Dependencies

  • GitHub API accessed via GitHub App authentication using an API key credential

Troubleshooting

  • Ensure the file path is correct and includes the full path within the repository; otherwise, the API may return an error or edit the wrong file.
  • If using binary data, verify the binary input field name matches the actual binary data field in the input.
  • The commit message is required; omitting it will cause the API request to fail.
  • If the branch is specified in additional parameters, ensure it exists in the repository; otherwise, the commit will fail.
  • Authentication errors may occur if the GitHub App credentials are invalid or lack necessary permissions.

Links

Discussion