{
  "name": "GitHub To TG",
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "url": "https://github.com/pseudoyu.atom"
      },
      "name": "RSS Feed Read",
      "type": "n8n-nodes-base.rssFeedRead",
      "typeVersion": 1,
      "position": [
        240,
        580
      ]
    },
    {
      "parameters": {
        "functionCode": "/* only return new items */\nconst staticData = getWorkflowStaticData('global');\nconst lastItemId = staticData.lastItemId;\n\nconsole.log('lastItemId', lastItemId);\nconst firstItem = items[0];\nlet newItems = [];\n\nfunction getId(item) {\n  return item.json.guid;\n}\n\nif (lastItemId) {\n  for (const item of items) {\n    if (getId(item) === lastItemId) {\n      break;\n    }\n    newItems.push(item)\n  }\n} else {\n  newItems = [firstItem]\n}\n\nstaticData.lastItemId = getId(firstItem)\nreturn newItems.reverse();"
      },
      "name": "Function",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        620,
        600
      ]
    },
    {
      "parameters": {
        "chatId": "@pseudoyulife",
        "text": "={{$json[\"tgTitle\"]}}\n\n{{$json[\"link\"]}}",
        "additionalFields": {
          "parse_mode": "HTML"
        }
      },
      "name": "Telegram",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1,
      "position": [
        800,
        460
      ],
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "interval": 10,
        "unit": "minutes"
      },
      "name": "Interval",
      "type": "n8n-nodes-base.interval",
      "typeVersion": 1,
      "position": [
        -40,
        620
      ]
    },
    {
      "parameters": {
        "functionCode": "/* filter items */\nconst newItems = [];\n\nconst regexes = {\n  'star': /^pseudoyu starred/,\n  'pull-request': /^pseudoyu opened a pull request/,\n  'issue': /^pseudoyu opened an issue/,\n}\nconst tagSymbols = {\n  'star': '\ud83c\udf1f',\n  'pull-request': '\u2934\ufe0f',\n  'issue': '\u26a1\ufe0f'\n}\n\nfor (const item of items) {\n  const title = item.json.title\n  let tag = ''\n\n  for (const key in regexes) {\n    const regex = regexes[key]\n    if (regex.test(title)) {\n      tag = key\n      break\n    }\n  }\n  if (tag !== '') {\n    item.json.tag = tag\n    item.json.tgTitle = `${tagSymbols[tag]} ${title.replace(/^pseudoyu /, '')} #github #${tag}`\n    item.json.guid = item.json.id\n    newItems.push(item)\n  }\n}\n\nreturn newItems"
      },
      "name": "Function filter",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        440,
        440
      ]
    }
  ],
  "connections": {
    "RSS Feed Read": {
      "main": [
        [
          {
            "node": "Function filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Function": {
      "main": [
        [
          {
            "node": "Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Interval": {
      "main": [
        [
          {
            "node": "RSS Feed Read",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Function filter": {
      "main": [
        [
          {
            "node": "Function",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "saveExecutionProgress": "DEFAULT",
    "errorWorkflow": "9"
  },
  "id": 3,
  "tags": []
}