Push Multiple Files To GitHub Repo Via REST API
detail.loadingPreview
This n8n workflow provides a robust solution for uploading multiple files simultaneously to a GitHub repository using the GitHub REST API. It bypasses the single-file upload limitation of the native GitHub node, enabling more complex version control automation.
About This Workflow
This workflow is an essential tool for developers and teams needing to automate the upload of multiple files to a GitHub repository in a single, atomic commit. Leveraging the GitHub REST API, it meticulously handles the underlying Git operations: fetching the latest commit, determining the base tree, creating a new tree object with your desired files and their content, forming a new commit referencing this tree, and finally updating the branch to reflect these changes. This structured approach ensures data integrity and offers a powerful alternative for scenarios where n8n's native GitHub node's single-file upload falls short, greatly enhancing your DevOps automation capabilities.
Key Features
- Multi-File Upload Capability: Uploads several files to a GitHub repository in a single, atomic commit, overcoming native node limitations.
- Full Git Process Automation: Manages the entire commit lifecycle, including fetching commit SHAs, creating new tree objects, generating commits, and updating branch references.
- Dynamic Configuration: Easily configure GitHub repository, username, branch, personal access token, and commit messages through a dedicated 'Set' node.
- Secure API Interaction: Authenticates with GitHub using a Personal Access Token (PAT) for secure and authorized operations.
- Flexible Content Handling: Designed to accept file content from preceding nodes, allowing for dynamic file generation and upload.
How To Use
- Configure GitHub Info: In the "Set Github Info" node, update the placeholders:
Github Token: Replace "YOUR_GITHUB_PAT_TOKEN" with a valid GitHub Personal Access Token (PAT) that hasreposcope.Github Repo: Enter the name of your target GitHub repository (e.g.,my-awesome-project).Github Username: Provide your GitHub username or the organization's name if applicable.Github Branch: Specify the target branch (e.g.,mainordevelop).Github Commit Update Message: Customize the commit message that will appear in your GitHub history.
- Provide File Content: Ensure that preceding nodes (like "File 1" and "File 2" referenced in "Create new tree") output the content for each file you intend to upload. The
Create new treenode expectscontentfor eachtreeitem. - Define File Paths: In the "Create new tree" node, adjust
tree[0].path,tree[1].path, etc., to the desired file paths within your GitHub repository. Add moretreeitems as needed for additional files. - Execute Workflow: Click "Test workflow" or set up a trigger node (e.g., a webhook or schedule) to run the workflow and push your files.
Apps Used
Workflow JSON
{
"id": "9e14ad1a-a644-4524-b1bc-9c694f78aa4a",
"name": "Push Multiple Files To GitHub Repo Via REST API",
"nodes": 18,
"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: 9e14ad1a-a644...
About the Author
SaaS_Connector
Integration Guru
Connecting CRM, Notion, and Slack to automate your life.
Statistics
Related Workflows
Discover more workflows you might like
Effortless Bug Reporting: Slack Slash Command to Linear Issue
Streamline your bug reporting process by instantly creating Linear issues directly from Slack using a simple slash command. This workflow enhances team collaboration by providing immediate feedback and a structured approach to logging defects, saving valuable time for development and QA teams.
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.