feat: add folder support for workflows (fixes #70)
This commit is contained in:
507
workflows/Gitlab/0557_Gitlab_Filter_Create_Scheduled.json
Normal file
507
workflows/Gitlab/0557_Gitlab_Filter_Create_Scheduled.json
Normal file
@@ -0,0 +1,507 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"id": "3e2820cb-24a4-491b-8f8b-60f97b0748dc",
|
||||
"name": "Backup Now - Manual Trigger",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"position": [
|
||||
520,
|
||||
320
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "bc5588e5-b67a-4713-b8e7-c21227048a2d",
|
||||
"name": "n8n",
|
||||
"type": "n8n-nodes-base.n8n",
|
||||
"position": [
|
||||
980,
|
||||
520
|
||||
],
|
||||
"parameters": {
|
||||
"filters": {
|
||||
"tags": "={{ $('Globals').first().json.tags_to_match_for_backup }}"
|
||||
},
|
||||
"requestOptions": {}
|
||||
},
|
||||
"credentials": {
|
||||
"n8nApi": {
|
||||
"id": "L3X3qWRmwZRYCpV8",
|
||||
"name": "Source n8n Account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "2a5af64d-b5c3-4180-bae5-9efeeaeba99d",
|
||||
"name": "Globals",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
740,
|
||||
400
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "150135fb-c0fb-444b-aeed-eac851af255d",
|
||||
"name": "gitlab_owner",
|
||||
"type": "string",
|
||||
"value": "mygitlabownername"
|
||||
},
|
||||
{
|
||||
"id": "8a9359c0-5a16-482b-8f3a-c8b20fbc13c0",
|
||||
"name": "gitlab_project",
|
||||
"type": "string",
|
||||
"value": "n8n_workflow_backups"
|
||||
},
|
||||
{
|
||||
"id": "00843c18-7d09-4d60-ab70-534ca0791504",
|
||||
"name": "gitlab_workflow_path",
|
||||
"type": "string",
|
||||
"value": "workflow_definitions"
|
||||
},
|
||||
{
|
||||
"id": "8fbcc201-dbff-440b-b440-42e8f1735548",
|
||||
"name": "tags_to_match_for_backup",
|
||||
"type": "string",
|
||||
"value": "gitlab_backup_enabled"
|
||||
},
|
||||
{
|
||||
"id": "e17051bc-d8b3-4cef-bad0-efe38a7be464",
|
||||
"name": "execution_type",
|
||||
"type": "string",
|
||||
"value": "={{ ( $('Schedule Trigger').isExecuted) ? 'Scheduled' : 'Manual' }}"
|
||||
},
|
||||
{
|
||||
"id": "8b90fba9-df11-4e07-a7ae-31405143e831",
|
||||
"name": "execution_time",
|
||||
"type": "string",
|
||||
"value": "={{ $now }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "b6b44b4b-e5a7-4ce6-9cff-e7a21679ad32",
|
||||
"name": "Create New File(s)",
|
||||
"type": "n8n-nodes-base.gitlab",
|
||||
"position": [
|
||||
2060,
|
||||
540
|
||||
],
|
||||
"parameters": {
|
||||
"owner": "={{ $('Globals').first().json.gitlab_owner }}",
|
||||
"branch": "main",
|
||||
"filePath": "={{ $('Globals').first().json.gitlab_workflow_path }}/{{ $('Derive Filename From Workflow Name').item.json.normalized_filename }}",
|
||||
"resource": "file",
|
||||
"repository": "={{ $('Globals').first().json.gitlab_project }}",
|
||||
"fileContent": "={{ JSON.stringify($('n8n').item.json, null, 4) }}",
|
||||
"commitMessage": "=(Initial) {{ $('Globals').first().json.execution_type }} Backup - {{ $('Globals').first().json.execution_time }}."
|
||||
},
|
||||
"credentials": {
|
||||
"gitlabApi": {
|
||||
"id": "Nv1DoplS64rrPZVm",
|
||||
"name": "Target GitLab Account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "167ae6cd-b8dd-4e01-aca4-4888fcaf9958",
|
||||
"name": "Edit Existing File(s)",
|
||||
"type": "n8n-nodes-base.gitlab",
|
||||
"position": [
|
||||
2060,
|
||||
340
|
||||
],
|
||||
"parameters": {
|
||||
"owner": "={{ $('Globals').first().json.gitlab_owner }}",
|
||||
"branch": "main",
|
||||
"filePath": "={{ $('Globals').first().json.gitlab_workflow_path }}/{{ $('Derive Filename From Workflow Name').item.json.normalized_filename }}",
|
||||
"resource": "file",
|
||||
"operation": "edit",
|
||||
"repository": "={{ $('Globals').first().json.gitlab_project }}",
|
||||
"fileContent": "={{ JSON.stringify($('n8n').item.json, null, 4) }}",
|
||||
"commitMessage": "={{ $('Globals').first().json.execution_type }} Backup - {{ $('Globals').first().json.execution_time }}."
|
||||
},
|
||||
"credentials": {
|
||||
"gitlabApi": {
|
||||
"id": "Nv1DoplS64rrPZVm",
|
||||
"name": "Target GitLab Account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "a4437388-9143-4c91-841e-c062ab9af3c0",
|
||||
"name": "Derive Filename From Workflow Name",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
1160,
|
||||
520
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "d2110dc6-1f31-46b3-991e-556b2255d76e",
|
||||
"name": "normalized_filename",
|
||||
"type": "string",
|
||||
"value": "={{ $json.name.replace(/[^a-zA-Z0-9]/g, '') }}.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "cb0fca8f-dc43-4903-a8e1-5b7acf9157b1",
|
||||
"name": "Fetch Existing File Content",
|
||||
"type": "n8n-nodes-base.gitlab",
|
||||
"position": [
|
||||
1640,
|
||||
340
|
||||
],
|
||||
"parameters": {
|
||||
"owner": "={{ $('Globals').first().json.gitlab_owner }}",
|
||||
"filePath": "={{ $('Globals').first().json.gitlab_workflow_path }}/{{ $('Derive Filename From Workflow Name').item.json.normalized_filename }}",
|
||||
"resource": "file",
|
||||
"operation": "get",
|
||||
"repository": "={{ $('Globals').first().json.gitlab_project }}",
|
||||
"asBinaryProperty": false,
|
||||
"additionalParameters": {
|
||||
"reference": "main"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"gitlabApi": {
|
||||
"id": "Nv1DoplS64rrPZVm",
|
||||
"name": "Target GitLab Account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "816843c4-769c-4033-a38e-1c6ef5325e15",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
940,
|
||||
120
|
||||
],
|
||||
"parameters": {
|
||||
"color": 5,
|
||||
"width": 401,
|
||||
"height": 246,
|
||||
"content": "## Gather Gitlab Info"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "19f3fe4d-acba-4e7b-b92c-ce9024a8f37d",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
940,
|
||||
460
|
||||
],
|
||||
"parameters": {
|
||||
"color": 5,
|
||||
"width": 398,
|
||||
"height": 240,
|
||||
"content": "## Gather n8n Info"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "418bef31-adf6-419b-87f1-faa2581e5766",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1380,
|
||||
280
|
||||
],
|
||||
"parameters": {
|
||||
"width": 598,
|
||||
"height": 384.41789416257484,
|
||||
"content": "## Decide Whether to Create or Edit or Skip"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "f3b98ded-c767-4822-bcf4-25931be03f48",
|
||||
"name": "Skip Unchanged Files",
|
||||
"type": "n8n-nodes-base.filter",
|
||||
"position": [
|
||||
1820,
|
||||
340
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"conditions": {
|
||||
"options": {
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "3298ab8b-9934-4ed7-9c38-03f325dc71e2",
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "notEquals"
|
||||
},
|
||||
"leftValue": "={{ JSON.stringify($('n8n').item.json, null, 4) }}",
|
||||
"rightValue": "={{ $json.content.base64Decode() }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "6bbf5146-7129-4ca8-8576-39d5cbe8e0b9",
|
||||
"name": "Sticky Note3",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
480,
|
||||
220
|
||||
],
|
||||
"parameters": {
|
||||
"color": 4,
|
||||
"width": 402,
|
||||
"height": 452,
|
||||
"content": "## Start / Trigger & Configure"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "0e5d9c9f-40b4-494d-8233-a2b4fea67d76",
|
||||
"name": "Schedule Trigger",
|
||||
"type": "n8n-nodes-base.scheduleTrigger",
|
||||
"position": [
|
||||
520,
|
||||
520
|
||||
],
|
||||
"parameters": {
|
||||
"rule": {
|
||||
"interval": [
|
||||
{
|
||||
"field": "cronExpression",
|
||||
"expression": "30 21 * * 6"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "be08176e-3961-43d7-b182-89a4f45805f6",
|
||||
"name": "Fetch List of Existing Files",
|
||||
"type": "n8n-nodes-base.gitlab",
|
||||
"position": [
|
||||
980,
|
||||
180
|
||||
],
|
||||
"parameters": {
|
||||
"owner": "={{ $('Globals').first().json.gitlab_owner }}",
|
||||
"filePath": "={{ $('Globals').first().json.gitlab_workflow_path }}",
|
||||
"resource": "file",
|
||||
"operation": "list",
|
||||
"returnAll": true,
|
||||
"repository": "={{ $('Globals').item.json.gitlab_project }}",
|
||||
"additionalParameters": {
|
||||
"ref": "main"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"gitlabApi": {
|
||||
"id": "Nv1DoplS64rrPZVm",
|
||||
"name": "Target GitLab Account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "674cdaa8-f8fe-4f6d-8743-062d3fd1ff95",
|
||||
"name": "Combine Gitlab Existing Files as Single List Item",
|
||||
"type": "n8n-nodes-base.aggregate",
|
||||
"position": [
|
||||
1180,
|
||||
180
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"fieldsToAggregate": {
|
||||
"fieldToAggregate": [
|
||||
{
|
||||
"renameField": true,
|
||||
"outputFieldName": "gitlab_existing_filenames",
|
||||
"fieldToAggregate": "name"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "463ae3fb-4d66-497d-81eb-7e55b5945d84",
|
||||
"name": "File Exists in Gitlab?",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
1440,
|
||||
460
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"conditions": {
|
||||
"options": {
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "0740c2be-ab9d-4249-af46-0d94f58c318f",
|
||||
"operator": {
|
||||
"type": "array",
|
||||
"operation": "contains",
|
||||
"rightType": "any"
|
||||
},
|
||||
"leftValue": "={{ $('Combine Gitlab Existing Files as Single List Item').first().json.gitlab_existing_filenames }}",
|
||||
"rightValue": "={{ $('Derive Filename From Workflow Name').item.json.normalized_filename }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 2
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"n8n": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Derive Filename From Workflow Name",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Globals": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Fetch List of Existing Files",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Schedule Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Globals",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Skip Unchanged Files": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Edit Existing File(s)",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"File Exists in Gitlab?": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Fetch Existing File Content",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Create New File(s)",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Backup Now - Manual Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Globals",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Fetch Existing File Content": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Skip Unchanged Files",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Fetch List of Existing Files": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Combine Gitlab Existing Files as Single List Item",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Derive Filename From Workflow Name": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "File Exists in Gitlab?",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Combine Gitlab Existing Files as Single List Item": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "n8n",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
752
workflows/Gitlab/0561_Gitlab_Code_Create_Triggered.json
Normal file
752
workflows/Gitlab/0561_Gitlab_Code_Create_Triggered.json
Normal file
@@ -0,0 +1,752 @@
|
||||
{
|
||||
"meta": {
|
||||
"instanceId": "d53e56b8545e15a14aa4da6d83ec1d0183c6196323c9b6f7c0a36af8ff413264",
|
||||
"templateCredsSetupCompleted": true
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"id": "9800aaf1-f330-4898-8da7-e60667ab9597",
|
||||
"name": "When clicking \"Test Workflow\"",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"position": [
|
||||
880,
|
||||
360
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "2772836c-7e75-4d99-a130-f249a3868843",
|
||||
"name": "Globals",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
1100,
|
||||
360
|
||||
],
|
||||
"parameters": {
|
||||
"fields": {
|
||||
"values": [
|
||||
{
|
||||
"name": "repo.owner",
|
||||
"stringValue": "owner-slug"
|
||||
},
|
||||
{
|
||||
"name": "repo.name",
|
||||
"stringValue": "repo-slug"
|
||||
},
|
||||
{
|
||||
"name": "repo.branch",
|
||||
"stringValue": "branch-slug"
|
||||
},
|
||||
{
|
||||
"name": "repo.path",
|
||||
"stringValue": "path"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 3.2
|
||||
},
|
||||
{
|
||||
"id": "21c87038-3b5f-4ff8-88f2-7dde7f92af17",
|
||||
"name": "Result",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"position": [
|
||||
1700,
|
||||
80
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "ff6c0a0a-3a2e-4eb7-9eac-1b6986dee524",
|
||||
"name": "Current workflow",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"position": [
|
||||
1720,
|
||||
460
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "d8e48d3c-6df9-4662-b06b-27572182c28d",
|
||||
"name": "Loop Over Workflows",
|
||||
"type": "n8n-nodes-base.splitInBatches",
|
||||
"position": [
|
||||
1500,
|
||||
360
|
||||
],
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 3
|
||||
},
|
||||
{
|
||||
"id": "01d1d850-f0e9-4f7d-877a-78cbec050d6e",
|
||||
"name": "Get file",
|
||||
"type": "n8n-nodes-base.gitlab",
|
||||
"onError": "continueErrorOutput",
|
||||
"position": [
|
||||
1960,
|
||||
460
|
||||
],
|
||||
"parameters": {
|
||||
"owner": "={{ $('Globals').first().json.repo.owner }}",
|
||||
"filePath": "={{ $('Globals').first().json.repo.path }}{{ $json.id }}.json",
|
||||
"resource": "file",
|
||||
"operation": "get",
|
||||
"repository": "={{ $('Globals').first().json.repo.name }}",
|
||||
"binaryPropertyName": "file-from-gitlab",
|
||||
"additionalParameters": {
|
||||
"reference": "={{ $('Globals').first().json.repo.branch }}"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"gitlabApi": {
|
||||
"id": "1JK5aC2W8tuDKw2e",
|
||||
"name": "GitLab account"
|
||||
}
|
||||
},
|
||||
"executeOnce": true,
|
||||
"typeVersion": 1,
|
||||
"alwaysOutputData": false
|
||||
},
|
||||
{
|
||||
"id": "1cc2e4b6-8143-4d11-8898-78521e2b0170",
|
||||
"name": "File status",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"position": [
|
||||
2620,
|
||||
440
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "runOnceForEachItem",
|
||||
"jsCode": "var item = $json;\n\n// Check first if is error\nif (item.error) {\n if (\"The resource you are requesting could not be found\" == item.error) {\n item[\"status\"] = \"new\";\n } else {\n item[\"status\"] = \"error\";\n }\n return $input.item;\n}\n\n// If not error check file with saved version\nvar workflowFromN8n = item[\"workflow-from-n8n\"];\nvar workflowFromGitlab = item[\"workflow-from-gitlab\"];\nvar areEquals = objectsAreEquals(workflowFromN8n, workflowFromGitlab);\n\nif (areEquals) {\n item[\"status\"] = \"same\";\n} else {\n item[\"status\"] = \"diff\";\n}\n\n// Return Item\nreturn item;\n\n/**\n * Compare to objects\n * @param object1 \n * @param object2 \n * @returns true if the are the same without ignored fields\n */\nfunction objectsAreEquals(object1, object2) {\n const objectKeys1 = Object.keys(object1);\n const objectKeys2 = Object.keys(object2);\n\n // If the numbers of fields are differents, the objects are differents\n if (objectKeys1.length !== objectKeys2.length) {\n return false;\n }\n for (const key of objectKeys1) {\n // Define some fields to be ignored\n var ignoreCurrent = false;\n switch (key) {\n case \"updatedAt\": // Changed because workflow change... not usefull\n case \"global\": // changed for running reasons, no need to check\n ignoreCurrent = true;\n }\n\n // If it's not an ignored field\n if (!ignoreCurrent) {\n const value1 = object1[key];\n const value2 = object2[key];\n const isBothAreObjects = isObject(value1) && isObject(value2);\n\n // If it's objects recursive check\n if (isBothAreObjects && !objectsAreEquals(value1, value2)) {\n return false;\n }\n\n // If it's not objects, just compare values\n if (!isBothAreObjects && value1 != value2) {\n return false;\n }\n }\n }\n return true;\n}\n\n/**\n * Tool function to determine if an parameter is an object\n * @param object \n * @returns \n */\nfunction isObject(object) {\n return object !== null && typeof object === \"object\";\n}\n"
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "8e428b8a-6ac3-47c6-aa53-7a461fcaab0c",
|
||||
"name": "Status error",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
3360,
|
||||
640
|
||||
],
|
||||
"parameters": {
|
||||
"fields": {
|
||||
"values": [
|
||||
{
|
||||
"name": "name",
|
||||
"stringValue": "={{ $('Current workflow').item.json.name }}"
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"stringValue": "=Error : {{ $json.error }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"include": "none",
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 3.2
|
||||
},
|
||||
{
|
||||
"id": "9007c9ae-bac0-4c65-9d50-c63d3a20f49c",
|
||||
"name": "End Loop",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"position": [
|
||||
3600,
|
||||
420
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "ac768b04-fa1f-4cef-8c7c-61508bb46bfc",
|
||||
"name": "Create file",
|
||||
"type": "n8n-nodes-base.gitlab",
|
||||
"onError": "continueErrorOutput",
|
||||
"position": [
|
||||
3100,
|
||||
140
|
||||
],
|
||||
"parameters": {
|
||||
"owner": "={{ $('Globals').first().json.repo.owner }}",
|
||||
"branch": "={{ $('Globals').first().json.repo.branch }}",
|
||||
"filePath": "={{ $('Globals').first().json.repo.path }}{{ $json.id }}.json",
|
||||
"resource": "file",
|
||||
"repository": "={{ $('Globals').first().json.repo.name }}",
|
||||
"fileContent": "={{ JSON.stringify($('Current workflow').item.json, null, 4) }}",
|
||||
"commitMessage": "=Create file for workflow {{ $('Current workflow').item.json.name }}",
|
||||
"additionalParameters": {
|
||||
"author": {
|
||||
"name": "n8n",
|
||||
"email": "noreply-n8n@mipih.fr"
|
||||
}
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"gitlabApi": {
|
||||
"id": "1JK5aC2W8tuDKw2e",
|
||||
"name": "GitLab account"
|
||||
}
|
||||
},
|
||||
"executeOnce": true,
|
||||
"typeVersion": 1,
|
||||
"alwaysOutputData": false
|
||||
},
|
||||
{
|
||||
"id": "17d32e40-56c1-46e1-b7a6-0438adf5069c",
|
||||
"name": "Extract From File",
|
||||
"type": "n8n-nodes-base.extractFromFile",
|
||||
"position": [
|
||||
2180,
|
||||
360
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"operation": "fromJson",
|
||||
"destinationKey": "workflow-from-gitlab",
|
||||
"binaryPropertyName": "file-from-gitlab"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "51a50508-bfe2-4a70-aa77-420c2f7d6ae1",
|
||||
"name": "Switch",
|
||||
"type": "n8n-nodes-base.switch",
|
||||
"position": [
|
||||
2880,
|
||||
440
|
||||
],
|
||||
"parameters": {
|
||||
"rules": {
|
||||
"values": [
|
||||
{
|
||||
"outputKey": "new",
|
||||
"conditions": {
|
||||
"options": {
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "equals"
|
||||
},
|
||||
"leftValue": "={{ $json.status }}",
|
||||
"rightValue": "new"
|
||||
}
|
||||
]
|
||||
},
|
||||
"renameOutput": true
|
||||
},
|
||||
{
|
||||
"outputKey": "same",
|
||||
"conditions": {
|
||||
"options": {
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "0ff6e053-e89d-49fa-b8c8-3a51ffe016d8",
|
||||
"operator": {
|
||||
"name": "filter.operator.equals",
|
||||
"type": "string",
|
||||
"operation": "equals"
|
||||
},
|
||||
"leftValue": "={{ $json.status }}",
|
||||
"rightValue": "same"
|
||||
}
|
||||
]
|
||||
},
|
||||
"renameOutput": true
|
||||
},
|
||||
{
|
||||
"outputKey": "diff",
|
||||
"conditions": {
|
||||
"options": {
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "b6b954c3-e74c-4f60-8e9e-ac79d4b741f3",
|
||||
"operator": {
|
||||
"name": "filter.operator.equals",
|
||||
"type": "string",
|
||||
"operation": "equals"
|
||||
},
|
||||
"leftValue": "={{ $json.status }}",
|
||||
"rightValue": "diff"
|
||||
}
|
||||
]
|
||||
},
|
||||
"renameOutput": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {
|
||||
"fallbackOutput": "extra",
|
||||
"renameFallbackOutput": "error"
|
||||
}
|
||||
},
|
||||
"typeVersion": 3
|
||||
},
|
||||
{
|
||||
"id": "4a71677b-2c35-40b3-a45c-320e0779a949",
|
||||
"name": "New file version",
|
||||
"type": "n8n-nodes-base.gitlab",
|
||||
"onError": "continueErrorOutput",
|
||||
"position": [
|
||||
3100,
|
||||
300
|
||||
],
|
||||
"parameters": {
|
||||
"owner": "={{ $('Globals').first().json.repo.owner }}",
|
||||
"branch": "={{ $('Globals').first().json.repo.branch }}",
|
||||
"filePath": "={{ $('Globals').first().json.repo.path }}{{ $json['workflow-from-n8n'].id }}.json",
|
||||
"resource": "file",
|
||||
"operation": "edit",
|
||||
"repository": "={{ $('Globals').first().json.repo.name }}",
|
||||
"fileContent": "={{ JSON.stringify($json['workflow-from-n8n'], null, 4) }}",
|
||||
"commitMessage": "=New file version for workflow {{ $json['workflow-from-n8n'].name }}"
|
||||
},
|
||||
"credentials": {
|
||||
"gitlabApi": {
|
||||
"id": "1JK5aC2W8tuDKw2e",
|
||||
"name": "GitLab account"
|
||||
}
|
||||
},
|
||||
"executeOnce": true,
|
||||
"typeVersion": 1,
|
||||
"alwaysOutputData": false
|
||||
},
|
||||
{
|
||||
"id": "a2d22bb4-ff42-41c5-8ef9-6214f114275e",
|
||||
"name": "Error output to normal output",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"position": [
|
||||
2180,
|
||||
560
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "c1932cee-dcb4-4f32-8eff-7ded3558ba53",
|
||||
"name": "Status new",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
3360,
|
||||
120
|
||||
],
|
||||
"parameters": {
|
||||
"fields": {
|
||||
"values": [
|
||||
{
|
||||
"name": "name",
|
||||
"stringValue": "={{ $('Current workflow').item.json.name }}"
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"stringValue": "new"
|
||||
}
|
||||
]
|
||||
},
|
||||
"include": "none",
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 3.2
|
||||
},
|
||||
{
|
||||
"id": "769cf25b-311a-4aaa-9eb8-5c9616f91beb",
|
||||
"name": "Status diff",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
3360,
|
||||
280
|
||||
],
|
||||
"parameters": {
|
||||
"fields": {
|
||||
"values": [
|
||||
{
|
||||
"name": "name",
|
||||
"stringValue": "={{ $('Current workflow').item.json.name }}"
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"stringValue": "diff"
|
||||
}
|
||||
]
|
||||
},
|
||||
"include": "none",
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 3.2
|
||||
},
|
||||
{
|
||||
"id": "3089818c-0020-4d13-864e-6f04b6ea9d91",
|
||||
"name": "Status same",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
3360,
|
||||
420
|
||||
],
|
||||
"parameters": {
|
||||
"fields": {
|
||||
"values": [
|
||||
{
|
||||
"name": "name",
|
||||
"stringValue": "={{ $('Current workflow').item.json.name }}"
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"stringValue": "same"
|
||||
}
|
||||
]
|
||||
},
|
||||
"include": "none",
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 3.2
|
||||
},
|
||||
{
|
||||
"id": "7fcffb00-2177-49b9-b0ee-7ccec076814d",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1920,
|
||||
160
|
||||
],
|
||||
"parameters": {
|
||||
"width": 839.0943396226413,
|
||||
"height": 587.9245283018865,
|
||||
"content": "## Check file\nGet the file.\nUse error output as normal output.\nSome code to analyse the file and set a status."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "1c0eff6a-e469-41bd-890c-76bc760a2b4e",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
2860,
|
||||
14
|
||||
],
|
||||
"parameters": {
|
||||
"width": 720.3234501347711,
|
||||
"height": 806.2533692722375,
|
||||
"content": "## Save the data\nSave the data as new or edited file, ignored or note as error."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "a02c50c9-fe6c-4c90-93ee-dc82b8fb3abe",
|
||||
"name": "Retrieve all workflows",
|
||||
"type": "n8n-nodes-base.n8n",
|
||||
"position": [
|
||||
1300,
|
||||
360
|
||||
],
|
||||
"parameters": {
|
||||
"filters": {}
|
||||
},
|
||||
"credentials": {
|
||||
"n8nApi": {
|
||||
"id": "9Skqv84KE7fa1hJx",
|
||||
"name": "n8n account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "ee96caf2-bf4d-4d10-a6bc-0a30ec9c9db8",
|
||||
"name": "Save each version in a different field",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
2400,
|
||||
360
|
||||
],
|
||||
"parameters": {
|
||||
"fields": {
|
||||
"values": [
|
||||
{
|
||||
"name": "workflow-from-gitlab",
|
||||
"type": "objectValue",
|
||||
"objectValue": "={{ $json['workflow-from-gitlab'] }}"
|
||||
},
|
||||
{
|
||||
"name": "workflow-from-n8n",
|
||||
"type": "objectValue",
|
||||
"objectValue": "={{ $('Current workflow').item.json }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 3.2
|
||||
}
|
||||
],
|
||||
"pinData": {},
|
||||
"connections": {
|
||||
"Switch": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Create file",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Status same",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "New file version",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Status error",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Globals": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Retrieve all workflows",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"End Loop": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Loop Over Workflows",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get file": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Extract From File",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Error output to normal output",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Status new": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "End Loop",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Create file": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Status new",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Status error",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"File status": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Switch",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Status diff": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "End Loop",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Status same": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "End Loop",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Status error": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "End Loop",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Current workflow": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get file",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"New file version": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Status diff",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Status error",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Extract From File": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Save each version in a different field",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Loop Over Workflows": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Result",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Current workflow",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Retrieve all workflows": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Loop Over Workflows",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Error output to normal output": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "File status",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"When clicking \"Test Workflow\"": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Globals",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Save each version in a different field": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "File status",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
25
workflows/Gitlab/0998_Gitlab_Automate_Triggered.json
Normal file
25
workflows/Gitlab/0998_Gitlab_Automate_Triggered.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"name": "Gitlab Trigger",
|
||||
"type": "n8n-nodes-base.gitlabTrigger",
|
||||
"position": [
|
||||
460,
|
||||
480
|
||||
],
|
||||
"webhookId": "0e855b27-6465-42be-9610-c61b2e09cef9",
|
||||
"parameters": {
|
||||
"owner": "n8n-io",
|
||||
"events": [
|
||||
"*"
|
||||
],
|
||||
"repository": "n8n-docs"
|
||||
},
|
||||
"credentials": {
|
||||
"gitlabApi": "gitlab_creds"
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"connections": {}
|
||||
}
|
||||
611
workflows/Gitlab/1895_Gitlab_Code_Automation_Webhook.json
Normal file
611
workflows/Gitlab/1895_Gitlab_Code_Automation_Webhook.json
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user