Backup tag-selected workflows to Gitlab
Fetches workflow definitions from within n8n, selecting only the ones that have one or more (configurable) assigned tags and then: 1. Derives a suitable back...
🔌 Nodes & Integrations Used (2)
📖 Implementation & Setup Guide
Fetches workflow definitions from within n8n, selecting only the ones that have one or more (configurable) assigned tags and then: 1. Derives a suitable backup filename by reducing the workflow name to a string with alphanumeric characters and no-spaces * *Note: This isn't bulletproof, but works as long as workflow names aren't too crazy.* 2. Determines which workflows need to be backed up based on whether each one: * has been modified. (*Note: Even repositioning a node counts.*) ...or... * is new. (*Note: Renaming counts as this.*) 3. Commits JSON copies of each workflow, as necessary, to a Gitlab repository with a generated, date-stamped commit message.
Setup ### Credentials * Create a Gitlab Credentials item and assign it to all Gitlab nodes. * Create an n8n Credentials item and assign it to the n8n node * Note: This was tested with **http://localhost:5678/api/v1** but should work with any reachable n8n instance and API key.
Modify these values in the "Globals" Node * **gitlab_owner** - {{your gitlab account}} * **gitlab_project** - {{ your gitlab project name }} * **gitlab_workflow_path** - {{ subdirectory in the project where backup files should be saved/committed }} * **tags_to_match_for_backup** - {{tag(s) to match for backup selection}} * ***ALERT:** According to the **n8n** node's **Filters -> tags** field annotations, and API documentation, this supports a CSV list of multiple tags (e.g. tag1,tag2), **but** the API behavior requires workflows to have **all-of** the listed tags, not **any-of** them.* * **See:** https://github.com/n8n-io/n8n/issues/10348 * **TL/DR** - Don't expect a multiple tag list to be **more** inclusive. * **Possible workaround:** To match more than one tag value, duplicate the n8n node into multiple single-tag matches, or split and iterate multiple values, and merge the results.
Possible Enhancements * Make the branch ("Reference") for all the gitlab nodes configurable. Fixed on all as "main" in the template. * Add an n8n node to generate an audit and store the output in gitlab along with the backups. * Extend the workflow at the end to create a Gitlab release/tag whenever any backup files are actually updated or created.
⚡ How to import this workflow into n8n:
- Click the Direct Download JSON button above to save
Backup tag-selected workflows to Gitlab.json. - Log in to your n8n Cloud or self-hosted n8n instance.
- In your workflow canvas, click the menu in top-right and select Import from File (or paste the JSON directly).
- Configure your credentials (e.g. API keys, database URLs) in the corresponding node settings.
- Click Execute Workflow to test and switch to Active!
Related DevOps & GitHub Workflows
View All in DevOps & GitHub →Generate Google Doc Proposal
Production-ready n8n automation template for Generate Google Doc Proposal built by AhiXLight. Seamlessly connects Execute Workflow Trigger, Google Drive, OpenAI with 7 configured nodes.
Add a new lead to Pipedrive once GitHub repo is forked
This workflow automatically adds a new lead to Pipedrive once someone forks your GitHub repository. Prerequisites - Pipedrive account and Pipedrive credentia...
Add the affiliate to a program automatically
This workflow allows you to create an affiliate, add metadata, and add the affiliate to a program. !workflow-screenshot Tapfiliate node: This node allows you...
Add a note to Pipedrive s contact once PR is added on GitHub
This workflow automatically adds a note of the PR from GitHub to the Pipedrive contact if their GitHub email matches a Person in Pipedrive. Prerequisites - P...