N
n8n Store
Workflow Market
blogbak

blogbak

by boagolden0 views

Description

Categories

🤖 AI & Machine Learning

Nodes Used

n8n-nodes-base.ifn8n-nodes-base.setn8n-nodes-base.setn8n-nodes-base.setn8n-nodes-base.coden8n-nodes-base.coden8n-nodes-base.noOpn8n-nodes-base.noOpn8n-nodes-base.noOpn8n-nodes-base.merge
PriceFree
Views0
Last Updated11/28/2025
workflow.json
{
  "id": "dR9Ks4IeLu4qwVpD",
  "meta": {
    "instanceId": "784e7394ad6bc96590ae2022cd99eaa229a70dd6b82a6d27cf116d99211f63ca",
    "templateCredsSetupCompleted": true
  },
  "name": "blogbak",
  "tags": [],
  "nodes": [
    {
      "id": "6fe6e1e5-146e-45fc-89a8-e318759c283b",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -620,
        -140
      ],
      "parameters": {
        "color": 6,
        "width": 2547,
        "height": 751,
        "content": "## Subworkflow"
      },
      "typeVersion": 1
    },
    {
      "id": "2e37f053-f5c4-4984-9855-ff82346fffb1",
      "name": "Return",
      "type": "n8n-nodes-base.set",
      "position": [
        1720,
        60
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "8d513345-6484-431f-afb7-7cf045c90f4f",
              "name": "Done",
              "type": "boolean",
              "value": true
            }
          ]
        }
      },
      "typeVersion": 3.3
    },
    {
      "id": "c84c112e-9ec4-4563-8829-7acfb4022537",
      "name": "Get File",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        820,
        -60
      ],
      "parameters": {
        "url": "={{ $json.download_url }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "c3c21099-fe26-4289-94d1-4a0fbf80743f",
      "name": "If file too large",
      "type": "n8n-nodes-base.if",
      "position": [
        620,
        -40
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 1,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "45ce825e-9fa6-430c-8931-9aaf22c42585",
              "operator": {
                "type": "string",
                "operation": "empty",
                "singleValue": true
              },
              "leftValue": "={{ $json.content }}",
              "rightValue": ""
            },
            {
              "id": "9619a55f-7fb1-4f24-b1a7-7aeb82365806",
              "operator": {
                "type": "string",
                "operation": "notExists",
                "singleValue": true
              },
              "leftValue": "={{ $json.error }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "5c296194-1b0c-49e9-87e1-0349ce14e053",
      "name": "Merge Items",
      "type": "n8n-nodes-base.merge",
      "position": [
        620,
        220
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "7ee60c81-2232-4aa8-8313-fa2493d6cf59",
      "name": "isDiffOrNew",
      "type": "n8n-nodes-base.code",
      "position": [
        820,
        220
      ],
      "parameters": {
        "jsCode": "const orderJsonKeys = (jsonObj) => {\n  const ordered = {};\n  Object.keys(jsonObj).sort().forEach(key => {\n    ordered[key] = jsonObj[key];\n  });\n  return ordered;\n}\n\n// Check if file returned with content\nif (Object.keys($input.all()[0].json).includes(\"content\")) {\n  // Decode base64 content and parse JSON\n  const origWorkflow = JSON.parse(Buffer.from($input.all()[0].json.content, 'base64').toString());\n  const n8nWorkflow = $input.all()[1].json;\n  \n  // Order JSON objects\n  const orderedOriginal = orderJsonKeys(origWorkflow);\n  const orderedActual = orderJsonKeys(n8nWorkflow);\n\n  // Determine difference\n  if (JSON.stringify(orderedOriginal) === JSON.stringify(orderedActual)) {\n    $input.all()[0].json.github_status = \"same\";\n  } else {\n    $input.all()[0].json.github_status = \"different\";\n    $input.all()[0].json.n8n_data_stringy = JSON.stringify(orderedActual, null, 2);\n  }\n  $input.all()[0].json.content_decoded = orderedOriginal;\n// No file returned / new workflow\n} else if (Object.keys($input.all()[0].json).includes(\"data\")) {\n  const origWorkflow = JSON.parse($input.all()[0].json.data);\n  const n8nWorkflow = $input.all()[1].json;\n  \n  // Order JSON objects\n  const orderedOriginal = orderJsonKeys(origWorkflow);\n  const orderedActual = orderJsonKeys(n8nWorkflow);\n\n  // Determine difference\n  if (JSON.stringify(orderedOriginal) === JSON.stringify(orderedActual)) {\n    $input.all()[0].json.github_status = \"same\";\n  } else {\n    $input.all()[0].json.github_status = \"different\";\n    $input.all()[0].json.n8n_data_stringy = JSON.stringify(orderedActual, null, 2);\n  }\n  $input.all()[0].json.content_decoded = orderedOriginal;\n\n} else {\n  // Order JSON object\n  const n8nWorkflow = $input.all()[1].json;\n  const orderedActual = orderJsonKeys(n8nWorkflow);\n  \n  // Proper formatting\n  $input.all()[0].json.github_status = \"new\";\n  $input.all()[0].json.n8n_data_stringy = JSON.stringify(orderedActual, null, 2);\n}\n\n// Return items\nreturn $input.all();"
      },
      "typeVersion": 1
    },
    {
      "id": "f80206e2-b0a4-4c25-bf6c-92a7bc0673e8",
      "name": "Check Status",
      "type": "n8n-nodes-base.switch",
      "position": [
        1040,
        220
      ],
      "parameters": {
        "rules": {
          "rules": [
            {
              "value2": "same"
            },
            {
              "output": 1,
              "value2": "different"
            },
            {
              "output": 2,
              "value2": "new"
            }
          ]
        },
        "value1": "={{$json.github_status}}",
        "dataType": "string"
      },
      "typeVersion": 1
    },
    {
      "id": "fe9da7b9-2706-4db2-bd5a-94d4fb398f07",
      "name": "Same file - Do nothing",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1260,
        60
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "6940d68b-75be-4ac5-a024-8fee5928137e",
      "name": "File is different",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1260,
        220
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "fb3ba897-7934-4a4d-9ebf-730fbc0f6e87",
      "name": "File is new",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1260,
        380
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "8bc1ca4b-d7ee-434c-b72f-327672941443",
      "name": "Create new file",
      "type": "n8n-nodes-base.github",
      "position": [
        1480,
        380
      ],
      "webhookId": "d7722bc1-3b69-4038-8f1e-ff7ba50498d1",
      "parameters": {
        "owner": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $('Globals').item.json.repo.owner }}"
        },
        "filePath": "={{ $('Globals').item.json.repo.path }}{{$('Execute Workflow Trigger').first().json.id}}.json",
        "resource": "file",
        "repository": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $('Globals').item.json.repo.name }}"
        },
        "fileContent": "={{$('isDiffOrNew').item.json[\"n8n_data_stringy\"]}}",
        "commitMessage": "={{$('Execute Workflow Trigger').first().json.name}} ({{$json.github_status}})"
      },
      "credentials": {
        "githubApi": {
          "id": "ziOYyVD5gQbrBGVj",
          "name": "GitHub account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "fc075cd9-fcf0-4cf0-a573-8e4dfdd0deb6",
      "name": "Edit existing file",
      "type": "n8n-nodes-base.github",
      "position": [
        1480,
        200
      ],
      "webhookId": "e55f87f7-9be4-425f-98b7-00ff88a09696",
      "parameters": {
        "owner": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $('Globals').item.json.repo.owner }}"
        },
        "filePath": "={{ $('Globals').item.json.repo.path }}{{$('Execute Workflow Trigger').first().json.id}}.json",
        "resource": "file",
        "operation": "edit",
        "repository": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $('Globals').item.json.repo.name }}"
        },
        "fileContent": "={{$('isDiffOrNew').item.json[\"n8n_data_stringy\"]}}",
        "commitMessage": "={{$('Execute Workflow Trigger').first().json.name}} ({{$json.github_status}})"
      },
      "credentials": {
        "githubApi": {
          "id": "ziOYyVD5gQbrBGVj",
          "name": "GitHub account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "2f2c0a8c-e152-4f04-a092-375e649a6f35",
      "name": "Get file data",
      "type": "n8n-nodes-base.github",
      "position": [
        420,
        -40
      ],
      "webhookId": "27006429-54a9-4234-a1ca-3ccc36a5a4ec",
      "parameters": {
        "owner": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $json.repo.owner }}"
        },
        "filePath": "={{ $json.repo.path }}{{ $('Execute Workflow Trigger').item.json.id }}.json",
        "resource": "file",
        "operation": "get",
        "repository": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $json.repo.name }}"
        },
        "asBinaryProperty": false,
        "additionalParameters": {}
      },
      "credentials": {
        "githubApi": {
          "id": "ziOYyVD5gQbrBGVj",
          "name": "GitHub account"
        }
      },
      "typeVersion": 1,
      "continueOnFail": true,
      "alwaysOutputData": true
    },
    {
      "id": "0283ac63-70bb-4230-a292-f6a70faab22f",
      "name": "Globals",
      "type": "n8n-nodes-base.set",
      "position": [
        200,
        120
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "6cf546c5-5737-4dbd-851b-17d68e0a3780",
              "name": "repo.owner",
              "type": "string",
              "value": "boagolden82"
            },
            {
              "id": "452efa28-2dc6-4ea3-a7a2-c35d100d0382",
              "name": "repo.name",
              "type": "string",
              "value": "n8nback"
            },
            {
              "id": "81c4dc54-86bf-4432-a23f-22c7ea831e74",
              "name": "repo.path",
              "type": "string",
              "value": "=workflows/{{ $json.tags[0].name }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "aa41b761-85ed-4837-a466-c5c03902b73c",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        180,
        0
      ],
      "parameters": {
        "color": 4,
        "width": 150,
        "height": 80,
        "content": "## Edit this node 👇"
      },
      "typeVersion": 1
    },
    {
      "id": "b9a961d5-63ba-4646-8a7d-920ba7ad8467",
      "name": "Execute Workflow Trigger",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        -520,
        300
      ],
      "parameters": {
        "inputSource": "passthrough"
      },
      "typeVersion": 1.1
    },
    {
      "id": "539e52b7-7772-4572-a8b4-a0b60cd21c7d",
      "name": "/",
      "type": "n8n-nodes-base.set",
      "position": [
        -40,
        20
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "12cad226-e091-4bbb-aed9-a8e01311772c",
              "name": "tags[0].name",
              "type": "string",
              "value": "={{ $('Execute Workflow Trigger').item.json.tags[0].name }}/"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "e821424a-9a5f-4eba-832f-530a62ce9898",
      "name": "tag?",
      "type": "n8n-nodes-base.switch",
      "position": [
        -280,
        120
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "tag",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "object",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.tags[0] }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "none",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "2656fbe3-fe35-4770-9c03-9a455ec618e4",
                    "operator": {
                      "type": "object",
                      "operation": "notExists",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.tags[0] }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "d5383175-b64b-43ba-b979-1737af2e3034",
      "name": "Manual Trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -480,
        -600
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "cab6effd-7aab-48ad-a035-1b5b4567d722",
      "name": "Get All WP Posts",
      "type": "n8n-nodes-base.wordpress",
      "position": [
        -180,
        -460
      ],
      "parameters": {
        "options": {},
        "operation": "getAll",
        "returnAll": true
      },
      "credentials": {
        "wordpressApi": {
          "id": "zgOcyZzeoCInkBr9",
          "name": "Wordpress account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "878acd66-e344-4c3a-9650-a27493be4942",
      "name": "Format JSON",
      "type": "n8n-nodes-base.code",
      "notes": "将所有WP文章格式化为JSON文本",
      "position": [
        80,
        -440
      ],
      "parameters": {
        "jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nfor (const item of $input.all()) {\n  item.json.myNewField = 1;\n}\n\nreturn $input.all();"
      },
      "typeVersion": 1
    },
    {
      "id": "ddb88bce-1243-426f-b6f8-5236cdf085a8",
      "name": "Execute Workflow",
      "type": "n8n-nodes-base.executeWorkflow",
      "position": [
        420,
        -460
      ],
      "parameters": {
        "mode": "each",
        "options": {},
        "workflowId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $workflow.id }}"
        },
        "workflowInputs": {
          "value": {},
          "schema": [],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "6b7426ad-7680-4227-92bc-90a3ae44bb3c",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -400,
        -360
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 17
            }
          ]
        }
      },
      "typeVersion": 1.2
    }
  ],
  "active": true,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "c128b71d-90e9-4503-82f0-555fd4e34a69",
  "connections": {
    "/": {
      "main": [
        [
          {
            "node": "Globals",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "tag?": {
      "main": [
        [
          {
            "node": "/",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Globals",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Globals": {
      "main": [
        [
          {
            "node": "Get file data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get File": {
      "main": [
        [
          {
            "node": "Merge Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "File is new": {
      "main": [
        [
          {
            "node": "Create new file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format JSON": {
      "main": [
        [
          {
            "node": "Execute Workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Items": {
      "main": [
        [
          {
            "node": "isDiffOrNew",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "isDiffOrNew": {
      "main": [
        [
          {
            "node": "Check Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Status": {
      "main": [
        [
          {
            "node": "Same file - Do nothing",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "File is different",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "File is new",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get file data": {
      "main": [
        [
          {
            "node": "If file too large",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Manual Trigger": {
      "main": [
        [
          {
            "node": "Get All WP Posts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create new file": {
      "main": [
        [
          {
            "node": "Return",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get All WP Posts": {
      "main": [
        [
          {
            "node": "Format JSON",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Get All WP Posts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "File is different": {
      "main": [
        [
          {
            "node": "Edit existing file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If file too large": {
      "main": [
        [
          {
            "node": "Get File",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Merge Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit existing file": {
      "main": [
        [
          {
            "node": "Return",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Same file - Do nothing": {
      "main": [
        [
          {
            "node": "Return",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute Workflow Trigger": {
      "main": [
        [
          {
            "node": "Merge Items",
            "type": "main",
            "index": 1
          },
          {
            "node": "tag?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

相关工作流