{
  "name": "Git to Tweet",
  "nodes": [
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        0
      ],
      "id": "caddc7f0-ba35-48c6-8847-57fbde929895",
      "name": "When clicking \u2018Execute workflow\u2019"
    },
    {
      "parameters": {
        "url": "=https://api.github.com/repos/{{ $('Edit Fields').item.json.GITHUB_REPO }}/commits",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/vnd.github+json"
            },
            {
              "name": "X-GitHub-Api-Version",
              "value": "2022-11-28"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.3,
      "position": [
        672,
        -116
      ],
      "id": "78fdbcf7-352e-4a64-b3da-dd6b289883ee",
      "name": "HTTP Request"
    },
    {
      "parameters": {
        "operation": "get",
        "dataTableId": {
          "__rl": true,
          "value": "gW82RyJSp9bkac0d",
          "mode": "list",
          "cachedResultName": "latest-sha",
          "cachedResultUrl": "/projects/H9205GKdHUE6huRg/datatables/gW82RyJSp9bkac0d"
        },
        "limit": 1
      },
      "type": "n8n-nodes-base.dataTable",
      "typeVersion": 1,
      "position": [
        448,
        -116
      ],
      "id": "bcbab918-639f-44a0-b3ac-1c6d08e3f9bf",
      "name": "Get row(s)"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "98d5a9aa-9a91-4968-b92d-c6a9a162bf11",
              "leftValue": "={{ $json.commit.author.date }}",
              "rightValue": "={{ $('Get row(s)').item.json.commitedAt }}",
              "operator": {
                "type": "dateTime",
                "operation": "after"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.filter",
      "typeVersion": 2.3,
      "position": [
        896,
        -116
      ],
      "id": "4af9dc5a-74a7-4ba2-99a0-7641a473548a",
      "name": "Filter"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=Review the following git diff and generate a message that summarizes the changes. The message should be short enough to fit into a regular tweet, and should be understandable by anyone. Bonus points if you can make it quirky and funny.\n\nExample:\nCommit title: feat: optimized image loading\nResult: Just cut load times by 40%. Users don't care about the stack, they care about speed\n\nOnly return the result message that should be shared to twitter, no other content.\n\nGit Diff:\n{{ $json.data }}",
        "batching": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "typeVersion": 1.7,
      "position": [
        1344,
        104
      ],
      "id": "0c75824e-2987-4acb-a979-02f01ee6922a",
      "name": "Basic LLM Chain"
    },
    {
      "parameters": {
        "model": "gemma3:12b",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmOllama",
      "typeVersion": 1,
      "position": [
        1416,
        328
      ],
      "id": "0c45ca78-e769-49d7-a30a-b26a2bbfdd9f",
      "name": "Ollama Model",
      "credentials": {
        "ollamaApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "url": "={{ $json.html_url }}.diff",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/vnd.github.v3.diff"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.3,
      "position": [
        1120,
        104
      ],
      "id": "5f37bb4e-986d-4bf5-a882-2a856ed2c140",
      "name": "HTTP Request1"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "={{ $('Edit Fields').item.json.BSKY_ROOT_URL }}/xrpc/com.atproto.server.createSession",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "identifier",
              "value": "={{ $('Edit Fields').item.json.BSKY_IDENTIFIER }}"
            },
            {
              "name": "password",
              "value": "={{ $('Edit Fields').item.json.BSKY_APP_PASSWORD }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.3,
      "position": [
        2368,
        -40
      ],
      "id": "4af9d28d-257f-4e8f-8ea3-92a3f6acb676",
      "name": "HTTP Request2"
    },
    {
      "parameters": {
        "operation": "sendAndWait",
        "chatId": "={{ $('Edit Fields').item.json.TELEGRAM_CHAT_ID }}",
        "message": "=New commit, want to post this message?\n{{ $json.text }}",
        "approvalOptions": {
          "values": {
            "approvalType": "double"
          }
        },
        "options": {}
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        1920,
        -112
      ],
      "id": "17f69b37-942e-4127-a82d-8de440e912aa",
      "name": "Send a text message",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [
        1696,
        104
      ],
      "id": "611f5cc5-e8af-42c9-8fc2-4db3178b634e",
      "name": "Loop Over Items"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 3
          },
          "conditions": [
            {
              "id": "a4541c9f-a600-4bfb-a6ca-1a9250a7a426",
              "leftValue": "={{ $json.data.approved }}",
              "rightValue": "true",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "and"
        },
        "looseTypeValidation": true,
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.3,
      "position": [
        2144,
        -40
      ],
      "id": "c332cdf5-37a4-47f2-a487-9be5e30e5b80",
      "name": "If"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "={{ $('Edit Fields').item.json.BSKY_ROOT_URL }}/xrpc/com.atproto.repo.createRecord",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{ $json.accessJwt }}"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"repo\": \"{{ $json.did }}\",\n  \"collection\": \"app.bsky.feed.post\",\n  \"record\": {\n    \"$type\": \"app.bsky.feed.post\",\n    \"text\": \"{{ $('Loop Over Items').item.json.text }}\",\n    \"createdAt\": \"{{ $now.toISO() }}\"\n  }\n} ",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.3,
      "position": [
        2592,
        104
      ],
      "id": "e9896d80-6cf9-4a3d-bdba-6bb09762856c",
      "name": "HTTP Request3"
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "minutes",
              "minutesInterval": 1
            }
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.3,
      "position": [
        0,
        -192
      ],
      "id": "fc7f9785-6893-472c-ad72-f5f71c6e0635",
      "name": "Schedule Trigger"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.limit",
      "typeVersion": 1,
      "position": [
        1120,
        -192
      ],
      "id": "ae8aa1e5-ef8e-4895-afa6-b19cfb576b34",
      "name": "Limit"
    },
    {
      "parameters": {
        "operation": "update",
        "dataTableId": {
          "__rl": true,
          "value": "gW82RyJSp9bkac0d",
          "mode": "list",
          "cachedResultName": "latest-sha",
          "cachedResultUrl": "/projects/H9205GKdHUE6huRg/datatables/gW82RyJSp9bkac0d"
        },
        "filters": {
          "conditions": [
            {
              "keyName": "commitedAt",
              "keyValue": "={{ $('Get row(s)').item.json.commitedAt }}"
            }
          ]
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "commitedAt": "={{ $json.commit.committer.date }}"
          },
          "matchingColumns": [
            "commitedAt"
          ],
          "schema": [
            {
              "id": "commitedAt",
              "displayName": "commitedAt",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "dateTime",
              "readOnly": false,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.dataTable",
      "typeVersion": 1,
      "position": [
        1408,
        -192
      ],
      "id": "f3ea6aef-7bc3-4866-a1fa-ed401b6d4f1a",
      "name": "Update row(s)"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "bb6f68b2-2f81-4614-8fc1-80659438082a",
              "name": "BSKY_ROOT_URL",
              "value": "https://bsky.app",
              "type": "string"
            },
            {
              "id": "fa2f22bb-d991-48f7-abfd-f8eb06a59fde",
              "name": "GITHUB_REPO",
              "value": "n8n-io/n8n",
              "type": "string"
            },
            {
              "id": "70abd441-8c06-45b2-a37a-8e854031b91a",
              "name": "TELEGRAM_CHAT_ID",
              "value": "0",
              "type": "string"
            },
            {
              "id": "382bf526-3c15-41a8-947b-0f8cb9540eb5",
              "name": "BSKY_IDENTIFIER",
              "value": "myname.bsky.app",
              "type": "string"
            },
            {
              "id": "e86816a7-e588-4dc1-b853-d80637e1074b",
              "name": "BSKY_APP_PASSWORD",
              "value": "supersecret",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        224,
        -116
      ],
      "id": "d230d5ff-60ca-45f3-a015-d5b4bb5f91b6",
      "name": "Edit Fields"
    }
  ],
  "connections": {
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s)": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter": {
      "main": [
        [
          {
            "node": "HTTP Request1",
            "type": "main",
            "index": 0
          },
          {
            "node": "Limit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ollama Model": {
      "ai_languageModel": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Basic LLM Chain": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request1": {
      "main": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Send a text message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send a text message": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If": {
      "main": [
        [
          {
            "node": "HTTP Request2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request2": {
      "main": [
        [
          {
            "node": "HTTP Request3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request3": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Limit": {
      "main": [
        [
          {
            "node": "Update row(s)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Get row(s)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "43f924e3-5d91-42ee-ac67-57965ce4885d",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "r7apLAvpXyT0Kqr4",
  "tags": []
}