Skip to main content

Auto-categorize blog posts with OpenAI GPT-4, GitHub, and Google Sheets for Astro/Next.js

Workflow preview

Workflow preview
100%
Auto-categorize blog posts with OpenAI GPT-4, GitHub, and Google Sheets for Astro/Next.js preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

Automatically Assign Categories and Tags to Blog Posts with AI This workflow streamlines your content organization process by automatically analyzing new blog posts in you...

Best for

  • Content Creation automation workflows
  • AI Summarization automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

@n8n/n8n-nodes-langchain.agent, @n8n/n8n-nodes-langchain.memorybufferwindow, @n8n/n8n-nodes-langchain.lmchatopenai, n8n-nodes-base.github, n8n-nodes-base.stickynote, n8n-nodes-base.googlesheets, n8n-nodes-base.code, n8n-nodes-base.aggregate

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Piotr Sikora.

Original n8n.io source

1.1 Workflow description

Title
Auto-categorize blog posts with OpenAI GPT-4, GitHub, and Google Sheets for Astro/Next.js
Workflow name
Auto-categorize blog posts with OpenAI GPT-4, GitHub, and Google Sheets for Astro/Next.js

Automatically Assign Categories and Tags to Blog Posts with AI

This workflow streamlines your content organization process by automatically analyzing new blog posts in your GitHub repository and assigning appropriate categories and tags using OpenAI. It compares new posts against existing entries in a Google Sheet, updates the metadata for each new article, and records the suggested tags and categories for review — all in one automated pipeline.


Who’s It For

  • Content creators and editors managing a static website (e.g., Astro or Next.js) who want AI-driven tagging.
  • SEO specialists seeking consistent metadata and topic organization.
  • Developers or teams managing a Markdown-based blog stored in GitHub who want to speed up post curation.

How It Works

  1. Form Trigger – Starts the process manually with a form that initiates article analysis.
  2. Get Data from Google Sheets – Retrieves existing post records to prevent duplicate analysis.
  3. Compare GitHub and Google Sheets – Lists all .md or .mdx blog posts from the GitHub repository (piotr-sikora.com/src/content/blog/pl/) and identifies new posts not yet analyzed.
  4. Check New Repo Files – Uses a code node to filter only unprocessed files for AI tagging.
  5. Switch Node
    • If there are no new posts, the workflow stops and shows a confirmation message.
    • If new posts exist, it continues to the next step.
  6. Get Post Content from GitHub – Downloads the content of each new article.
  7. AI Agent (LangChain + OpenAI GPT-4.1-mini)
    • Reads each post’s frontmatter (--- section) and body.
    • Suggests new categories and tags based on the article’s topic.
    • Returns a JSON object with proposed updates (Structured Output Parser)
  8. Append to Google Sheets – Logs results, including:
    • File name
    • Existing tags and categories
    • Proposed tags and categories (AI suggestions)
  9. Completion Message – Displays a success message confirming the categorization process has finished.

Requirements

  • GitHub account with repository access to your website content.
  • Google Sheets connection for storing metadata suggestions.
  • OpenAI account (credential stored in openAiApi).

How to Set Up

  1. Connect your GitHub, Google Sheets, and OpenAI credentials in n8n.
  2. Update the GitHub repository path to match your project (e.g., src/content/blog/en/).
  3. In Google Sheets, create columns:
    • FileName, Categories, Proposed Categories, Tags, Proposed Tags.
  4. Adjust the AI model or prompt text if you want different tagging behavior.
  5. Run the workflow manually using the Form Trigger node.

How to Customize

  • Swap OpenAI GPT-4.1-mini for another LLM (e.g., Claude or Gemini) via the LangChain node.
  • Modify the prompt in the AI Agent to adapt categorization style or tone.
  • Add a GitHub commit node if you want AI-updated metadata written back to files automatically.
  • Use the Schedule Trigger node to automate this process daily.

Important Notes

  • All API keys and credentials are securely stored — no hardcoded keys.
  • The workflow includes multiple sticky notes explaining:
    • Repository setup
    • File retrieval and AI tagging
    • Google Sheet data structure
  • It uses a LangChain memory buffer to improve contextual consistency during multiple analyses.

Summary

This workflow automates metadata management for blogs or documentation sites by combining GitHub content, AI categorization, and Google Sheets tracking.
With it, you can easily maintain consistent tags and categories across dozens of articles — boosting SEO, readability, and editorial efficiency without manual tagging.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - AI Agent

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 2.2

Block 2 - Simple Memory

Type / Role
@n8n/n8n-nodes-langchain.memoryBufferWindow - memoryBufferWindow
Config choices
Version 1.3

Block 3 - OpenAI Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.2

Block 4 - List posts/articles/pages

Type / Role
n8n-nodes-base.github - github
Config choices
Version 1.1

Block 5 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 6 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 7 - Append rows with posts / article analysis

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.7

Block 8 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 9 - Get post/article file

Type / Role
n8n-nodes-base.github - github
Config choices
Version 1.1

Block 10 - Get row(s) in sheet

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.7

Block 11 - List FileName only / Remove duplicates

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 12 - Get paths to files only from GitHub repository

Type / Role
n8n-nodes-base.aggregate - aggregate
Config choices
Version 1

Block 13 - Get file paths only from GoogleSheets

Type / Role
n8n-nodes-base.aggregate - aggregate
Config choices
Version 1

Block 14 - Check new repo files for AI processing

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 15 - Switch

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3.3

Block 16 - On form submission

Type / Role
n8n-nodes-base.formTrigger - formTrigger
Config choices
Version 2.3

Block 17 - No new posts/articles in GitHub

Type / Role
n8n-nodes-base.form - form
Config choices
Version 2.3

Block 18 - Proces finished - Categories and tags added

Type / Role
n8n-nodes-base.form - form
Config choices
Version 2.3

Block 19 - Merge GitHub and Google Sheets read

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.2

Block 20 - Structured Output Parser

Type / Role
@n8n/n8n-nodes-langchain.outputParserStructured - outputParserStructured
Config choices
Version 1.3

Block 21 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 22 - Sticky Note4

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 23 - Sticky Note5

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 24 - Sticky Note6

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Showing the first 24 of 29 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Auto-categorize blog posts with OpenAI GPT-4, GitHub, and Google Sheets for Astro/Next.js
Complexity advanced
Nodes 29
Categories Content Creation, AI Summarization
Author Piotr Sikora
Published 21 Oct 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/9983/9983.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Auto-categorize blog posts with OpenAI GPT-4, GitHub, and Google Sheets for Astro/Next.js do?

Automatically Assign Categories and Tags to Blog Posts with AI This workflow streamlines your content organization process by automatically analyzing new blog posts in you...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Content Creation, AI Summarization use case.