n8n-sauvegarde/Sauvegarde Gitea.json

1 line
9.6 KiB
JSON

{"createdAt":"2024-06-19T17:53:31.033Z","updatedAt":"2024-06-19T20:47:53.716Z","id":"kZvM4K7vwhKvtIkw","name":"Sauvegarde Gitea","active":false,"nodes":[{"parameters":{"rule":{"interval":[{}]}},"id":"99853d4c-6cd9-4632-b2e7-8477b61a927e","name":"Schedule Trigger","type":"n8n-nodes-base.scheduleTrigger","typeVersion":1.2,"position":[-1040,140]},{"parameters":{"filters":{},"requestOptions":{}},"id":"53eab512-36c6-4b94-90d4-01ea91065bcb","name":"n8n","type":"n8n-nodes-base.n8n","typeVersion":1,"position":[-840,220],"credentials":{"n8nApi":{"id":"LPFILq2KSvbWK8vk","name":"n8n account"}}},{"parameters":{"operation":"toJson","mode":"each","options":{"fileName":"={{ $json.name }}"}},"id":"8640e0b6-dc5a-45d2-8fab-6d2713e4b896","name":"Convert to File","type":"n8n-nodes-base.convertToFile","typeVersion":1.1,"position":[-660,220]},{"parameters":{"operation":"write","fileName":"=/tmp/comp/{{ $binary.data.fileName }}.json","options":{}},"id":"d1908c71-5bfe-43fc-a109-7dc79bd844b4","name":"Read/Write Files from Disk","type":"n8n-nodes-base.readWriteFile","typeVersion":1,"position":[-480,220]},{"parameters":{"command":"mkdir -p /tmp/comp && rm -rf /tmp/repo /tmp/comp/* "},"id":"5645af60-d3af-459d-9e3f-32429ff63b4e","name":"Execute Command1","type":"n8n-nodes-base.executeCommand","typeVersion":1,"position":[-840,60]},{"parameters":{"authentication":"gitPassword","operation":"clone","repositoryPath":"/tmp/repo","sourceRepository":"https://gitea.ia86.cc/perso/n8n-sauvegarde"},"id":"df61e886-fc5c-4f04-ac03-325c3534c22a","name":"Git","type":"n8n-nodes-base.git","typeVersion":1,"position":[-480,60],"credentials":{"gitPassword":{"id":"7JHhvGSTGUGgQb6S","name":"gitea.ia86.cc account"}}},{"parameters":{"mode":"chooseBranch","output":"empty"},"id":"7da55c97-6b1e-425b-ad42-9221e2db8869","name":"Merge","type":"n8n-nodes-base.merge","typeVersion":2.1,"position":[-300,140]},{"parameters":{"operation":"status","repositoryPath":"/tmp/repo"},"id":"08ff2375-45f6-4d20-8e27-c1cc3743f0a0","name":"Git1","type":"n8n-nodes-base.git","typeVersion":1,"position":[40,140]},{"parameters":{"operation":"add","repositoryPath":"/tmp/repo","pathsToAdd":"*"},"id":"f3efec1e-b45a-40b6-b233-2fbee5170890","name":"Git2","type":"n8n-nodes-base.git","typeVersion":1,"position":[460,340]},{"parameters":{"aggregate":"aggregateAllItemData","options":{}},"id":"08ea4b96-dbb7-4e67-9c83-5e9413b886f4","name":"Aggregate","type":"n8n-nodes-base.aggregate","typeVersion":1,"position":[460,160]},{"parameters":{"errorMessage":"ERREUR DANS GIT"},"id":"f87a3c10-0adf-4004-8bf9-455305556c36","name":"Stop and Error","type":"n8n-nodes-base.stopAndError","typeVersion":1,"position":[460,0]},{"parameters":{"operation":"commit","repositoryPath":"/tmp/repo","message":"=auto: {{ $json.currentDate }}","options":{}},"id":"d08883f3-bb02-469e-bb68-b123e6048413","name":"Git3","type":"n8n-nodes-base.git","typeVersion":1,"position":[780,160]},{"parameters":{"operation":"status","repositoryPath":"/tmp/repo"},"id":"fc6cf06a-5ac9-4bb2-a058-5f7744c2a2af","name":"Git4","type":"n8n-nodes-base.git","typeVersion":1,"position":[940,160]},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"f62f6c9f-3ef3-4b85-bfca-ae123526cbcc","leftValue":"={{ $json.ahead }}","rightValue":1,"operator":{"type":"number","operation":"equals"}}],"combinator":"and"},"options":{}},"id":"e2bb2b3c-93ea-4475-9b10-3c65dc464464","name":"If","type":"n8n-nodes-base.if","typeVersion":2,"position":[1100,160]},{"parameters":{"operation":"push","repositoryPath":"/tmp/repo","options":{}},"id":"84745a3f-a552-47cd-a671-6f9bb8e12565","name":"Git5","type":"n8n-nodes-base.git","typeVersion":1,"position":[1260,40]},{"parameters":{},"id":"8b718e16-64e2-4c47-a5ce-ec09bf60ac4d","name":"No Operation, do nothing","type":"n8n-nodes-base.noOp","typeVersion":1,"position":[1260,280]},{"parameters":{"fromEmail":"nico@ia86.cc","toEmail":"nicolas@palon.fr","subject":"=[N8N-SAVE]: {{ $json.date }} - {{ $('Git1').item.json.files.length }} modifs","html":"={{ $('ListFiles').item.json.stdout }}\nHash: {{ $('Git1').item.json.files.length }}","options":{"replyTo":"noreply@n8n.ia86.cc"}},"id":"e9a821a8-0018-4363-93c9-6f2251de3bec","name":"Send Email","type":"n8n-nodes-base.emailSend","typeVersion":2.1,"position":[1900,40],"credentials":{"smtp":{"id":"d4ZAN48vF9GTpVON","name":"SMTP account"}}},{"parameters":{"options":{}},"id":"1facf71d-e3ea-47bc-b5fd-eb537ff32ebf","name":"DateTime","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[620,160]},{"parameters":{"repositoryPath":"/tmp/repo","options":{}},"id":"18dc9799-fea1-4e42-a5eb-16ca5c9a289e","name":"Git6","type":"n8n-nodes-base.git","typeVersion":1,"position":[1420,40]},{"parameters":{"sortFieldsUi":{"sortField":[{"fieldName":"date","order":"descending"}]},"options":{}},"id":"4e76c8a4-db9a-449a-8df1-de12814654b3","name":"Sort","type":"n8n-nodes-base.sort","typeVersion":1,"position":[1580,40]},{"parameters":{"keep":"lastItems"},"id":"cc455ab0-bfc1-437c-a9f2-e5a49dbc9a93","name":"Limit","type":"n8n-nodes-base.limit","typeVersion":1,"position":[1740,40]},{"parameters":{"rules":{"values":[{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"leftValue":"={{ $json.staged.length }}","rightValue":0,"operator":{"type":"number","operation":"gt"}}],"combinator":"and"},"renameOutput":true,"outputKey":"staged"},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"ce17ff24-9901-4413-b722-5af58c23ae75","leftValue":"={{ $json.conflicted.length }}","rightValue":0,"operator":{"type":"number","operation":"gt"}}],"combinator":"and"},"renameOutput":true,"outputKey":"conflicted"},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"007665fd-3964-405b-a211-8b5cf45fca1c","leftValue":"={{ $json.created.length }}","rightValue":0,"operator":{"type":"number","operation":"gt"}}],"combinator":"and"},"renameOutput":true,"outputKey":"created"},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"4eb5a697-cf77-4962-a9d3-c016ec13ca61","leftValue":"={{ $json.deleted.length }}","rightValue":0,"operator":{"type":"number","operation":"gt"}}],"combinator":"and"},"renameOutput":true,"outputKey":"deleted"},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"e567e8c9-98df-463b-9df4-deffcab85d8a","leftValue":"={{ $json.modified.length }}","rightValue":0,"operator":{"type":"number","operation":"gt"}}],"combinator":"and"},"renameOutput":true,"outputKey":"modifled"},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"75f6edd0-8245-4cae-815c-b394776c6258","leftValue":"={{ $json.renamed.length }}","rightValue":0,"operator":{"type":"number","operation":"gt"}}],"combinator":"and"},"renameOutput":true,"outputKey":"renamed"},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"30f3c8d2-a595-4e0b-a25f-b6f75a2d4061","leftValue":"={{ $json.not_added.length }}","rightValue":0,"operator":{"type":"number","operation":"gt"}}],"combinator":"and"},"renameOutput":true,"outputKey":"not_added"},{"renameOutput":true,"outputKey":"RIEN"}]},"options":{}},"id":"1134c729-2994-4230-ab71-e24fb094c550","name":"Switch","type":"n8n-nodes-base.switch","typeVersion":3,"position":[220,120]},{"parameters":{"command":"cp /tmp/comp/* /tmp/repo && cd /tmp/repo && echo -en \"# Sauvegarde\\n\\n\" > ./README.md && ls *.json||sed ':a;N;$!ba;s/\\n/<br>/g' >> ./README.md && cat ./README.md"},"id":"0b343682-5b1e-423a-ae0f-50910c9f5729","name":"ListFiles","type":"n8n-nodes-base.executeCommand","typeVersion":1,"position":[-140,140]}],"connections":{"Schedule Trigger":{"main":[[{"node":"Execute Command1","type":"main","index":0},{"node":"n8n","type":"main","index":0}]]},"n8n":{"main":[[{"node":"Convert to File","type":"main","index":0}]]},"Convert to File":{"main":[[{"node":"Read/Write Files from Disk","type":"main","index":0}]]},"Execute Command1":{"main":[[{"node":"Git","type":"main","index":0}]]},"Git":{"main":[[{"node":"Merge","type":"main","index":0}]]},"Read/Write Files from Disk":{"main":[[{"node":"Merge","type":"main","index":1}]]},"Merge":{"main":[[{"node":"ListFiles","type":"main","index":0}]]},"Git1":{"main":[[{"node":"Switch","type":"main","index":0}]]},"Git2":{"main":[[{"node":"Git1","type":"main","index":0}]]},"Aggregate":{"main":[[{"node":"DateTime","type":"main","index":0}]]},"Git3":{"main":[[{"node":"Git4","type":"main","index":0}]]},"Git4":{"main":[[{"node":"If","type":"main","index":0}]]},"If":{"main":[[{"node":"Git5","type":"main","index":0}],[{"node":"No Operation, do nothing","type":"main","index":0}]]},"DateTime":{"main":[[{"node":"Git3","type":"main","index":0}]]},"Git6":{"main":[[{"node":"Sort","type":"main","index":0}]]},"Git5":{"main":[[{"node":"Git6","type":"main","index":0}]]},"Sort":{"main":[[{"node":"Limit","type":"main","index":0}]]},"Limit":{"main":[[{"node":"Send Email","type":"main","index":0}]]},"Switch":{"main":[[{"node":"Aggregate","type":"main","index":0}],[{"node":"Stop and Error","type":"main","index":0}],[{"node":"Git2","type":"main","index":0}],[{"node":"Git2","type":"main","index":0}],[{"node":"Git2","type":"main","index":0}],[{"node":"Git2","type":"main","index":0}],[{"node":"Git2","type":"main","index":0}],[{"node":"No Operation, do nothing","type":"main","index":0}]]},"ListFiles":{"main":[[{"node":"Git1","type":"main","index":0}]]}},"settings":{"executionOrder":"v1"},"staticData":null,"meta":{"templateCredsSetupCompleted":true},"pinData":{},"versionId":"d585f63d-7087-419a-9848-a0263f8bdcf3","triggerCount":0,"tags":[]}