Automated Multi-File Upload to GitHub via n8n

somdn_product_page

This n8n workflow automates the process of uploading multiple files to a GitHub repository using the GitHub REST API. Designed to overcome the limitations of native single-file uploads, it allows users to batch upload files efficiently. The workflow involves setting GitHub credentials, preparing file contents, creating a new tree with multiple files, committing those changes, and updating the branch to reflect these updates. It is triggered manually, making it suitable for routine or on-demand batch uploads.

### Workflow Breakdown:

1. Manual Trigger: Initiates the process.

2. Set GitHub Info: Configures GitHub credentials such as username, repo, branch, token, and commit message.

3. Prepare Files: Defines the content of multiple files (here, File 1 and File 2).

4. Get Latest Commit SHA: Retrieves the latest SHA of the branch to base changes on.

5. Get Base Tree SHA: Fetches the current tree SHA of the latest commit.

6. Create New Tree: Incorporates multiple files into a new tree object, referencing the base tree.

7. Create Commit: Commits the new tree with a message, referencing the previous commit.

8. Update Branch: Moves the branch pointer to the new commit, finalizing the update.

This workflow is ideal for developers and teams automating content updates, documentation, or managing multiple files in a GitHub repository without manual uploads, thereby saving time and reducing errors.

### Practical Uses:

– Automating content deployment in software projects.

– Batch updating documentation or assets.

– Synchronizing local files with a remote repository.

– Regular backups of important files.

– CI/CD pipelines for code and content management.

Node Count

6 – 10 Nodes

Nodes Used

httpRequest, manualTrigger, set, stickyNote

Reviews

There are no reviews yet.

Be the first to review “Automated Multi-File Upload to GitHub via n8n”

Your email address will not be published. Required fields are marked *