github_repo_workflows_sync

Avanzado

Este es unAIflujo de automatización del dominio deautomatización que contiene 25 nodos.Utiliza principalmente nodos como If, N8n, Set, Code, Filter, combinando tecnología de inteligencia artificial para lograr automatización inteligente. Sincronización bidireccional de flujos de trabajo de GitHub con n8n y control de versiones

Requisitos previos
  • Personal Access Token de GitHub
Vista previa del flujo de trabajo
Visualización de las conexiones entre nodos, con soporte para zoom y panorámica
Exportar flujo de trabajo
Copie la siguiente configuración JSON en n8n para importar y usar este flujo de trabajo
{
  "id": "zlH1bFBsYAWpBVVw",
  "meta": {
    "instanceId": "c63eb69e3ae130557a7966f936bb2cc113f6e64ff70b2268c8cd506848caf9d5",
    "templateCredsSetupCompleted": true
  },
  "name": "github_repo_workflows_sync",
  "tags": [
    {
      "id": "oiAlopPbS90SR7YK",
      "name": "github",
      "createdAt": "2025-06-20T15:54:28.386Z",
      "updatedAt": "2025-06-20T15:54:28.386Z"
    }
  ],
  "nodes": [
    {
      "id": "ffc98138-8afa-4cd6-8ba4-b235cc18c739",
      "name": "Crear nuevo flujo de trabajo en n8n",
      "type": "n8n-nodes-base.n8n",
      "position": [
        1740,
        780
      ],
      "parameters": {
        "operation": "create",
        "requestOptions": {},
        "workflowObject": "={{ $json.toJsonString()  }}"
      },
      "typeVersion": 1
    },
    {
      "id": "d4891039-f8d2-465b-bbb6-098050f9e06c",
      "name": "Activador programado",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -260,
        280
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "weeks",
              "triggerAtDay": [
                1
              ]
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "174b78dc-e584-4fc1-82a2-0e58b4a98b36",
      "name": "Listar archivos del repositorio",
      "type": "n8n-nodes-base.github",
      "position": [
        360,
        400
      ],
      "webhookId": "0614066f-212d-4f9e-9da2-fa4a80b44baf",
      "parameters": {
        "owner": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $json.github_account_name }}"
        },
        "filePath": "=/{{ $json.repo_workflows_path }}",
        "resource": "file",
        "operation": "list",
        "repository": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $json.github_repo_name }}"
        }
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "3dcf4423-8024-4797-adee-71912ba87c2b",
      "name": "GitHub",
      "type": "n8n-nodes-base.github",
      "position": [
        800,
        400
      ],
      "webhookId": "71ad7d84-99cd-4fbd-a365-52537e69525b",
      "parameters": {
        "owner": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $('Set GitHub Details').item.json.github_account_name }}"
        },
        "filePath": "={{ $json.path }}",
        "resource": "file",
        "operation": "get",
        "repository": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $('Set GitHub Details').item.json.github_repo_name }}"
        },
        "asBinaryProperty": false,
        "additionalParameters": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "315a2e65-1c4d-46b4-b17d-b949c776c116",
      "name": "n8n",
      "type": "n8n-nodes-base.n8n",
      "position": [
        580,
        200
      ],
      "parameters": {
        "filters": {},
        "requestOptions": {}
      },
      "typeVersion": 1
    },
    {
      "id": "404e87cf-e561-4807-865a-26a6109c228f",
      "name": "Subir archivo",
      "type": "n8n-nodes-base.github",
      "position": [
        2400,
        -80
      ],
      "webhookId": "ce4b561b-acb9-4cd8-b76f-4928dada9674",
      "parameters": {
        "owner": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $('Set GitHub Details').item.json.github_account_name }}"
        },
        "filePath": "={{ $('Set GitHub Details').item.json.repo_workflows_path }}/{{ $node['Edit for Upload'].json.fileName }}",
        "resource": "file",
        "repository": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $('Set GitHub Details').item.json.github_repo_name }}"
        },
        "fileContent": "={{ $('To base64').item.json.data }}",
        "commitMessage": "=n8n_backup_sync-{{ $node['Edit for Upload'].json.commitDate }}",
        "additionalParameters": {
          "branch": {
            "branch": "main"
          }
        }
      },
      "typeVersion": 1
    },
    {
      "id": "aee4f541-7ff4-441d-9c6b-1545676be55a",
      "name": "Archivo Json",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        1740,
        -80
      ],
      "parameters": {
        "mode": "each",
        "options": {
          "format": true
        },
        "operation": "toJson"
      },
      "typeVersion": 1.1
    },
    {
      "id": "9047c039-ef8e-4fb2-b58c-3056f02366c7",
      "name": "A base64",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        1960,
        -80
      ],
      "parameters": {
        "options": {},
        "operation": "binaryToPropery"
      },
      "typeVersion": 1
    },
    {
      "id": "e5208d64-7f41-4be4-ad09-313aeb5fa89d",
      "name": "Nota adhesiva",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1620,
        180
      ],
      "parameters": {
        "color": 3,
        "width": 340,
        "height": 400,
        "content": "## CHECK WHICH IS NEWER\n\n**IF TRUE** github workflow is the most recent, n8n to be updated\n\n**IF FALSE** n8n workflow is the most recent, github to be updated\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "138bd609-541a-46d6-aa1e-792e85a58c05",
      "name": "Actualizar archivo",
      "type": "n8n-nodes-base.github",
      "position": [
        3220,
        560
      ],
      "webhookId": "27218087-8df7-474d-a39f-70cfa9c34ec8",
      "parameters": {
        "owner": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $('Set GitHub Details').item.json.github_account_name }}"
        },
        "filePath": "={{ $('Set GitHub Details').item.json.repo_workflows_path }}/{{ $node['Edit for Update'].json.fileName }}",
        "resource": "file",
        "operation": "edit",
        "repository": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $('Set GitHub Details').item.json.github_repo_name }}"
        },
        "fileContent": "={{ $('To base').item.json.data }}",
        "commitMessage": "=n8n_backup_sync-{{ $('Edit for Update').item.json.commitDate }}"
      },
      "typeVersion": 1
    },
    {
      "id": "72bd601d-fdce-4643-a26d-23e95f278110",
      "name": "Archivo1 Json",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        2560,
        560
      ],
      "parameters": {
        "mode": "each",
        "options": {
          "format": true
        },
        "operation": "toJson"
      },
      "typeVersion": 1.1
    },
    {
      "id": "3974d157-1135-4068-bc3e-b295917cd49b",
      "name": "A base",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        2780,
        560
      ],
      "parameters": {
        "options": {},
        "operation": "binaryToPropery"
      },
      "typeVersion": 1
    },
    {
      "id": "eee2bfd1-e0e3-4db5-b4da-1bbc189f45e7",
      "name": "n8n vs GitHub",
      "type": "n8n-nodes-base.compareDatasets",
      "position": [
        1260,
        280
      ],
      "parameters": {
        "options": {},
        "mergeByFields": {
          "values": [
            {
              "field1": "id",
              "field2": "id"
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "a94d4e6e-a250-4fe8-a092-a9e1697745c5",
      "name": "Actualizar flujo de trabajo en n8n",
      "type": "n8n-nodes-base.n8n",
      "position": [
        2340,
        300
      ],
      "parameters": {
        "operation": "update",
        "workflowId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.dataset.id }}"
        },
        "requestOptions": {},
        "workflowObject": "={{ $json.dataset.toJsonString() }}"
      },
      "typeVersion": 1
    },
    {
      "id": "09d43ee5-7a21-47cd-8bec-45ae16e8422f",
      "name": "Código - InputB",
      "type": "n8n-nodes-base.code",
      "position": [
        2120,
        300
      ],
      "parameters": {
        "language": "python",
        "pythonCode": "# Get the desired workflow name\nworkflow_id = _('If n8n before GitHub').first().json['same']['id']\n\n# Get all decoded workflow items\nall_decoded = _('Decode to json').all()\n\n# Filter for the matching one\nmatched = [\n    item.json \n    for item in all_decoded \n    if item.json.get('id') == workflow_id\n]\n\n# If there's a match, return it (or empty if none)\nif matched:\n    return [{'json': {'dataset': matched[0]}}]\nelse:\n    return []\n"
      },
      "typeVersion": 2
    },
    {
      "id": "d3be821f-a331-4dc7-993d-6af348fb1fb2",
      "name": "Código - InputA",
      "type": "n8n-nodes-base.code",
      "position": [
        2120,
        560
      ],
      "parameters": {
        "language": "python",
        "pythonCode": "# Get the desired workflow name\nworkflow_id = _('If n8n before GitHub').first().json['same']['id']\n\n# Get all decoded workflow items\nall_decoded = _('n8n').all()\n\n# Filter for the matching one\nmatched = [\n    item.json \n    for item in all_decoded \n    if item.json.get('id') == workflow_id\n]\n\n# If there's a match, return it (or empty if none)\nif matched:\n    return [{'json': {'dataset': matched[0]}}]\nelse:\n    return []\n"
      },
      "typeVersion": 2
    },
    {
      "id": "2a173594-512b-4308-b685-540bac3e2338",
      "name": "Editar campos",
      "type": "n8n-nodes-base.set",
      "position": [
        2340,
        560
      ],
      "parameters": {
        "mode": "raw",
        "options": {},
        "jsonOutput": "={{ $json.dataset }}"
      },
      "typeVersion": 3.4
    },
    {
      "id": "7a43de98-2d25-4d0f-9b7c-47258dc7b405",
      "name": "Editar para subida",
      "type": "n8n-nodes-base.set",
      "position": [
        2180,
        -80
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "fe4a36ef-9f04-40e3-99bd-cc517a49b440",
              "name": "commitDate",
              "type": "string",
              "value": "={{ $now.format('dd-MM-yyyy/H:mm') }}"
            },
            {
              "id": "b0fe1bcc-e79c-4a6b-b8b4-44222c8bf4e8",
              "name": "fileName",
              "type": "string",
              "value": "={{$('n8n vs GitHub').item.json.name\n.trim().replace(/\\s+/g, '-').toLowerCase()\n}}.json"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "911736bd-1c6d-4b49-ade2-52d95f075a7f",
      "name": "Editar para actualización",
      "type": "n8n-nodes-base.set",
      "position": [
        3000,
        560
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "fe4a36ef-9f04-40e3-99bd-cc517a49b440",
              "name": "commitDate",
              "type": "string",
              "value": "={{ $now.format('dd-MM-yyyy/H:mm') }}"
            },
            {
              "id": "b0fe1bcc-e79c-4a6b-b8b4-44222c8bf4e8",
              "name": "fileName",
              "type": "string",
              "value": "={{\n$('Code - InputA').item.json.dataset.name.trim().replace(/\\s+/g, '-').toLowerCase()\n}}.json"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "1193d962-fb0d-4b9e-b94c-04c8942860e4",
      "name": "Nota adhesiva1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1620,
        -200
      ],
      "parameters": {
        "width": 1000,
        "height": 320,
        "content": "## IF ONLY IN N8N\nUpdate GitHub with the relevant workflows"
      },
      "typeVersion": 1
    },
    {
      "id": "e48eda08-7f73-46d6-ba81-f9e4b008fec3",
      "name": "Nota adhesiva2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1620,
        640
      ],
      "parameters": {
        "color": 6,
        "width": 340,
        "height": 340,
        "content": "## IF ONLY IN GITHUB\nCreate new workflow in n8n"
      },
      "typeVersion": 1
    },
    {
      "id": "c1909c33-d3f0-4d24-b4d7-fdf1e8074398",
      "name": "Si n8n antes que GitHub",
      "type": "n8n-nodes-base.if",
      "position": [
        1740,
        400
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "8ccf743b-3a66-44c0-a30b-72a1d4bcf60b",
              "operator": {
                "type": "dateTime",
                "operation": "before"
              },
              "leftValue": "={{ $json.different.updatedAt.inputA }}",
              "rightValue": "={{ $json.different.updatedAt.inputB }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "fd1022a0-4f67-4603-bf94-68415776c587",
      "name": "Decodificar a json",
      "type": "n8n-nodes-base.set",
      "position": [
        1020,
        400
      ],
      "parameters": {
        "mode": "raw",
        "options": {},
        "jsonOutput": "={{  $json.content.base64Decode() }}"
      },
      "typeVersion": 3.4
    },
    {
      "id": "102aadd9-ace3-4fc6-a9a9-ca546362373e",
      "name": "Filtrar",
      "type": "n8n-nodes-base.filter",
      "position": [
        580,
        400
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "b9ed0bad-4ebe-4378-807e-1a6082c4461d",
              "operator": {
                "type": "string",
                "operation": "notContains"
              },
              "leftValue": "={{ $json.name }}",
              "rightValue": "placeholder"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "0ddf93a8-4db3-4826-a658-8fb4aedb31ce",
      "name": "Establecer detalles de GitHub",
      "type": "n8n-nodes-base.set",
      "position": [
        -40,
        280
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "850e7497-0f2f-470e-a5a2-a85a0c12aaa2",
              "name": "github_account_name",
              "type": "string",
              "value": ""
            },
            {
              "id": "5c2be15a-cb93-4fe4-a512-03a1880b8713",
              "name": "github_repo_name",
              "type": "string",
              "value": ""
            },
            {
              "id": "f4f1f0c3-7a89-427c-942f-d0e74ba4583f",
              "name": "repo_workflows_path",
              "type": "string",
              "value": ""
            }
          ]
        }
      },
      "typeVersion": 3.4
    }
  ],
  "active": true,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "f8dfa54c-eb76-40f0-80d8-18cdab254091",
  "connections": {
    "315a2e65-1c4d-46b4-b17d-b949c776c116": {
      "main": [
        [
          {
            "node": "eee2bfd1-e0e3-4db5-b4da-1bbc189f45e7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "102aadd9-ace3-4fc6-a9a9-ca546362373e": {
      "main": [
        [
          {
            "node": "3dcf4423-8024-4797-adee-71912ba87c2b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3dcf4423-8024-4797-adee-71912ba87c2b": {
      "main": [
        [
          {
            "node": "fd1022a0-4f67-4603-bf94-68415776c587",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3974d157-1135-4068-bc3e-b295917cd49b": {
      "main": [
        [
          {
            "node": "911736bd-1c6d-4b49-ade2-52d95f075a7f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "aee4f541-7ff4-441d-9c6b-1545676be55a": {
      "main": [
        [
          {
            "node": "9047c039-ef8e-4fb2-b58c-3056f02366c7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "9047c039-ef8e-4fb2-b58c-3056f02366c7": {
      "main": [
        [
          {
            "node": "7a43de98-2d25-4d0f-9b7c-47258dc7b405",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "72bd601d-fdce-4643-a26d-23e95f278110": {
      "main": [
        [
          {
            "node": "3974d157-1135-4068-bc3e-b295917cd49b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2a173594-512b-4308-b685-540bac3e2338": {
      "main": [
        [
          {
            "node": "72bd601d-fdce-4643-a26d-23e95f278110",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d3be821f-a331-4dc7-993d-6af348fb1fb2": {
      "main": [
        [
          {
            "node": "2a173594-512b-4308-b685-540bac3e2338",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "09d43ee5-7a21-47cd-8bec-45ae16e8422f": {
      "main": [
        [
          {
            "node": "a94d4e6e-a250-4fe8-a092-a9e1697745c5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "eee2bfd1-e0e3-4db5-b4da-1bbc189f45e7": {
      "main": [
        [
          {
            "node": "aee4f541-7ff4-441d-9c6b-1545676be55a",
            "type": "main",
            "index": 0
          }
        ],
        [],
        [
          {
            "node": "c1909c33-d3f0-4d24-b4d7-fdf1e8074398",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "ffc98138-8afa-4cd6-8ba4-b235cc18c739",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "fd1022a0-4f67-4603-bf94-68415776c587": {
      "main": [
        [
          {
            "node": "eee2bfd1-e0e3-4db5-b4da-1bbc189f45e7",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "911736bd-1c6d-4b49-ade2-52d95f075a7f": {
      "main": [
        [
          {
            "node": "138bd609-541a-46d6-aa1e-792e85a58c05",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "7a43de98-2d25-4d0f-9b7c-47258dc7b405": {
      "main": [
        [
          {
            "node": "404e87cf-e561-4807-865a-26a6109c228f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d4891039-f8d2-465b-bbb6-098050f9e06c": {
      "main": [
        [
          {
            "node": "0ddf93a8-4db3-4826-a658-8fb4aedb31ce",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "0ddf93a8-4db3-4826-a658-8fb4aedb31ce": {
      "main": [
        [
          {
            "node": "315a2e65-1c4d-46b4-b17d-b949c776c116",
            "type": "main",
            "index": 0
          },
          {
            "node": "174b78dc-e584-4fc1-82a2-0e58b4a98b36",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "c1909c33-d3f0-4d24-b4d7-fdf1e8074398": {
      "main": [
        [
          {
            "node": "09d43ee5-7a21-47cd-8bec-45ae16e8422f",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "d3be821f-a331-4dc7-993d-6af348fb1fb2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "174b78dc-e584-4fc1-82a2-0e58b4a98b36": {
      "main": [
        [
          {
            "node": "102aadd9-ace3-4fc6-a9a9-ca546362373e",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Preguntas frecuentes

¿Cómo usar este flujo de trabajo?

Copie el código de configuración JSON de arriba, cree un nuevo flujo de trabajo en su instancia de n8n y seleccione "Importar desde JSON", pegue la configuración y luego modifique la configuración de credenciales según sea necesario.

¿En qué escenarios es adecuado este flujo de trabajo?

Avanzado - Inteligencia Artificial

¿Es de pago?

Este flujo de trabajo es completamente gratuito, puede importarlo y usarlo directamente. Sin embargo, tenga en cuenta que los servicios de terceros utilizados en el flujo de trabajo (como la API de OpenAI) pueden requerir un pago por su cuenta.

Información del flujo de trabajo
Nivel de dificultad
Avanzado
Número de nodos25
Categoría1
Tipos de nodos11
Descripción de la dificultad

Adecuado para usuarios avanzados, flujos de trabajo complejos con 16+ nodos

Autor
Wikus Bergh

Wikus Bergh

@rustedviking

Software/ML engineer - happily ambling on the path of learning

Enlaces externos
Ver en n8n.io

Compartir este flujo de trabajo

Categorías

Categorías: 34