{
  "nodes": [
    {
      "id": "b3f0b4a9-34ea-4630-8756-eb43f8ecb4ff",
      "name": "When clicking \"Execute Workflow\"",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        220,
        640
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "f5cb92f3-c3df-4640-90c1-870c9f27d085",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        830,
        402
      ],
      "parameters": {
        "width": 865.0290253216738,
        "height": 244.559082047148,
        "content": "## Push a single file via GitHub node directly to the remote GitHub repo"
      },
      "typeVersion": 1
    },
    {
      "id": "54f7a07c-8d85-4c69-81c9-a95449958eb4",
      "name": "GitHub push edited file",
      "type": "n8n-nodes-base.github",
      "position": [
        1200,
        480
      ],
      "parameters": {
        "owner": {
          "__rl": true,
          "mode": "list",
          "value": "teds-tech-talks",
          "cachedResultUrl": "https://github.com/teds-tech-talks",
          "cachedResultName": "teds-tech-talks"
        },
        "filePath": "README.md",
        "resource": "file",
        "operation": "edit",
        "repository": {
          "__rl": true,
          "mode": "list",
          "value": "git_push_article",
          "cachedResultUrl": "https://github.com/teds-tech-talks/git_push_article",
          "cachedResultName": "git_push_article"
        },
        "fileContent": "={{ $json.data }}\n## Updated at:\n{{ $now.toISO() }}",
        "commitMessage": "updated from n8n via GitHub node",
        "authentication": "oAuth2"
      },
      "credentials": {
        "githubOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "2b625156-17a5-4245-9ee8-604a631d65fe",
      "name": "Update README and add new file",
      "type": "n8n-nodes-base.executeCommand",
      "position": [
        1040,
        800
      ],
      "parameters": {
        "command": "=echo '' >> {{ $('config').item.json.localrepo }}/README.md\necho '## Updated at:' >> {{ $('config').item.json.localrepo }}/README.md\necho '{{ $now.toISO() }}' >> {{ $('config').item.json.localrepo }}/README.md\necho 'Check new file' >> {{ $('config').item.json.localrepo }}/README.md\necho '' >> {{ $('config').item.json.localrepo }}/README.md\n\necho '# This is a new file' >> {{ $('config').item.json.localrepo }}/new_{{ $now.toFormat('yyyyddMM-hhmmss') }}.md"
      },
      "typeVersion": 1
    },
    {
      "id": "99bf3b00-7e51-49b6-a602-8769012d9270",
      "name": "Add files",
      "type": "n8n-nodes-base.git",
      "position": [
        1200,
        800
      ],
      "parameters": {
        "operation": "add",
        "pathsToAdd": ".",
        "repositoryPath": "={{ $('config').item.json.localrepo }}"
      },
      "typeVersion": 1
    },
    {
      "id": "f0e220c5-d717-471f-8b0c-cca3a06ff7f6",
      "name": "Commit",
      "type": "n8n-nodes-base.git",
      "position": [
        1360,
        800
      ],
      "parameters": {
        "message": "updated from n8n via Git node",
        "options": {},
        "operation": "commit",
        "repositoryPath": "={{ $('config').item.json.localrepo }}"
      },
      "typeVersion": 1
    },
    {
      "id": "7ef8674e-3c1f-4903-aa3e-28af69d80264",
      "name": "Push",
      "type": "n8n-nodes-base.git",
      "position": [
        1520,
        800
      ],
      "parameters": {
        "options": {
          "targetRepository": "https://github.com/teds-tech-talks/git_push_article.git"
        },
        "operation": "push",
        "authentication": "gitPassword",
        "repositoryPath": "={{ $('config').item.json.localrepo }}"
      },
      "credentials": {
        "gitPassword": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f27bb600-4352-47db-aeeb-7688fa6c72c1",
      "name": "config",
      "type": "n8n-nodes-base.set",
      "position": [
        520,
        640
      ],
      "parameters": {
        "values": {
          "string": [
            {
              "name": "localrepo",
              "value": "/path/to/git/repo"
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 2
    },
    {
      "id": "512f0333-358d-43e6-a03f-b13792969d04",
      "name": "Pull",
      "type": "n8n-nodes-base.git",
      "position": [
        880,
        800
      ],
      "parameters": {
        "operation": "pull",
        "repositoryPath": "={{ $('config').item.json.localrepo }}"
      },
      "typeVersion": 1
    },
    {
      "id": "2830b321-5b58-4080-9a53-ddc703a80ec9",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        827.4395480225996,
        720
      ],
      "parameters": {
        "width": 870.5619913953059,
        "height": 251.5433184970501,
        "content": "## Push all changes via Git node"
      },
      "typeVersion": 1
    },
    {
      "id": "da8b52dd-4245-4adb-aff8-63f19a002d16",
      "name": "GitHub get file",
      "type": "n8n-nodes-base.github",
      "position": [
        880,
        480
      ],
      "parameters": {
        "owner": {
          "__rl": true,
          "mode": "list",
          "value": "teds-tech-talks",
          "cachedResultUrl": "https://github.com/teds-tech-talks",
          "cachedResultName": "teds-tech-talks"
        },
        "filePath": "README.md",
        "resource": "file",
        "operation": "get",
        "repository": {
          "__rl": true,
          "mode": "list",
          "value": "git_push_article",
          "cachedResultUrl": "https://github.com/teds-tech-talks/git_push_article",
          "cachedResultName": "git_push_article"
        },
        "authentication": "oAuth2",
        "additionalParameters": {}
      },
      "credentials": {
        "githubOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "e4eb2f71-5b66-4ab7-bb1a-b48ef25728e1",
      "name": "Decode file",
      "type": "n8n-nodes-base.code",
      "position": [
        1040,
        480
      ],
      "parameters": {
        "jsCode": "var text = Buffer.from($input.first().binary.data.data, 'base64').toString('utf8');\nreturn {\"data\": text};"
      },
      "typeVersion": 2
    },
    {
      "id": "ec27d375-b994-415c-be53-5715df83585c",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        400.9808509052974,
        440
      ],
      "parameters": {
        "width": 373.9894195663518,
        "height": 383.3156992772523,
        "content": "## Please update the path to the local repository and connect this node to the upper or lower parts of the workflow"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Pull": {
      "main": [
        [
          {
            "node": "Update README and add new file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Commit": {
      "main": [
        [
          {
            "node": "Push",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add files": {
      "main": [
        [
          {
            "node": "Commit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Decode file": {
      "main": [
        [
          {
            "node": "GitHub push edited file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GitHub get file": {
      "main": [
        [
          {
            "node": "Decode file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update README and add new file": {
      "main": [
        [
          {
            "node": "Add files",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \"Execute Workflow\"": {
      "main": [
        [
          {
            "node": "config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}