Automate Multi-File GitHub Pushes with n8n
detail.loadingPreview
Effortlessly upload multiple files to your GitHub repository using the GitHub REST API. This n8n workflow overcomes the single-file limitation of standard GitHub integrations, enabling robust automation for your development processes.
About This Workflow
This n8n workflow provides a powerful solution for programmatically pushing multiple files to a GitHub repository. It leverages the GitHub REST API to perform a series of operations: fetching the latest commit SHA, obtaining the base tree SHA, creating a new tree with your desired files, committing these changes with a custom message, and finally updating the branch. This bypasses the limitations of nodes that only support single-file uploads, making it ideal for CI/CD pipelines, automated documentation updates, or deploying static assets directly to your repository.
Key Features
- Automated Multi-File Uploads: Upload an arbitrary number of files to your GitHub repository in a single operation.
- GitHub REST API Integration: Utilizes the robust GitHub REST API for precise control over repository updates.
- Customizable Commit Messages: Define your own commit messages for better version tracking.
- Branch Updates: Safely updates your specified branch with the new commit.
- Error Handling Potential: While not explicitly shown, the modular nature allows for adding error handling for a more resilient workflow.
How To Use
- Set GitHub Credentials: In the 'Set Github Info' node, replace placeholder values with your actual GitHub Personal Access Token (PAT), repository name, username, and desired branch.
- Configure Files: In the 'Create new tree' node, specify the
path,mode,type, andcontentfor each file you want to upload. Thecontentcan be dynamically sourced from previous nodes (e.g., using$('File 1').item.json.content). - Define Commit Message: Update the 'Github Commit Update Message' in the 'Set Github Info' node to accurately describe your commit.
- Test Workflow: Click the 'Test workflow' button on the 'When clicking ‘Test workflow’' node to execute the automation. Monitor the output of each node to ensure successful execution.
Apps Used
Workflow JSON
{
"id": "e35aed25-06d6-4db0-b408-0f82225483d5",
"name": "Automate Multi-File GitHub Pushes with n8n",
"nodes": 20,
"category": "DevOps",
"status": "active",
"version": "1.0.0"
}Note: This is a sample preview. The full workflow JSON contains node configurations, credentials placeholders, and execution logic.
Get This Workflow
ID: e35aed25-06d6...
About the Author
DevOps_Master_X
Infrastructure Expert
Specializing in CI/CD pipelines, Docker, and Kubernetes automations.
Statistics
Related Workflows
Discover more workflows you might like
Automate Qualys Report Generation and Retrieval
Streamline your Qualys security reporting by automating the generation and retrieval of reports. This workflow ensures timely access to crucial security data without manual intervention.
Automated PR Merged QA Notifications
Streamline your QA process with this automated workflow that notifies your team upon successful Pull Request merges. Leverage AI and vector stores to enrich notifications and ensure seamless integration into your development pipeline.
Visualize Your n8n Workflows: Interactive Dashboard with Mermaid.js
Gain unparalleled visibility into your n8n automation landscape. This workflow transforms your n8n instance into a dynamic, interactive dashboard, leveraging Mermaid.js to visualize all your workflows in one accessible place.