by InlinexDev

Automating Daily SEO Blog Posts with Gemini AI and GitHub Actions

How we built a system that generates and publishes one SEO-optimized blog post per day to Shopify using Gemini AI and GitHub Actions.

Gemini AISEOGitHub ActionsShopifyautomation

The SEO Content Problem

Small e-commerce stores know they need blog content for SEO, but consistently producing quality articles is hard. Hiring writers is expensive, and writing yourself takes time away from running the business. What if AI could generate genuinely useful, SEO-optimized blog posts and publish them automatically?

That's exactly what we built for Inlinex, a Shopify store selling inline skates.

How It Works

The system runs as a GitHub Actions workflow that fires daily:

  1. Research — queries Google Search API for trending topics in the niche
  2. Generate — uses Gemini AI to write an SEO-optimized article
  3. Publish — pushes the article to Shopify via the Admin API

The GitHub Actions Workflow

name: Daily Blog Post
on:
  schedule:
    - cron: '0 6 * * *'  # 6 AM UTC daily
  workflow_dispatch: {}    # Manual trigger for testing

jobs:
  generate-post:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '20'
      - run: npm ci
      - run: node generate-post.js
        env:
          GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
          GOOGLE_SEARCH_KEY: ${{ secrets.GOOGLE_SEARCH_KEY }}
          GOOGLE_SEARCH_CX: ${{ secrets.GOOGLE_SEARCH_CX }}
          SHOPIFY_STORE: ${{ secrets.SHOPIFY_STORE }}
          SHOPIFY_TOKEN: ${{ secrets.SHOPIFY_TOKEN }}

Topic Research with Google Search API

Rather than generating random topics, the system researches what people are actually searching for:

async function findTrendingTopics(niche) {
  const queries = [
    `${niche} tips ${new Date().getFullYear()}`,
    `best ${niche} for beginners`,
    `${niche} maintenance guide`,
    `how to choose ${niche}`
  ];

  const results = [];
  for (const query of queries) {
    const response = await fetch(
      `https://www.googleapis.com/customsearch/v1?q=${encodeURIComponent(query)}&key=${API_KEY}&cx=${CX}`
    );
    const data = await response.json();
    results.push(...data.items.map(item => ({
      title: item.title,
      snippet: item.snippet,
      url: item.link
    })));
  }

  return results;
}

This gives the AI context about what's currently ranking, so it can create content that fills gaps rather than duplicating existing articles.

Content Generation with Gemini

The prompt engineering is crucial. A generic prompt produces generic content. Our prompt includes:

  • The store's brand voice and expertise areas
  • Competitor content snippets (for differentiation)
  • SEO requirements (target word count, heading structure)
  • Previously published topics (to avoid repetition)
const prompt = `
You are a content writer for ${STORE_NAME}, an expert in ${NICHE}.

Write a blog post about: ${selectedTopic}

Requirements:
- 800-1200 words
- Include an H1 title and at least 3 H2 subheadings
- Natural keyword usage (no stuffing)
- Include practical tips readers can use immediately
- End with a subtle call-to-action
- Do NOT cover these previously published topics: ${previousTopics.join(', ')}

Competitor content for reference (differentiate from these):
${competitorSnippets}
`;

Publishing to Shopify

The Shopify Admin API makes publishing straightforward:

async function publishToShopify(article) {
  const response = await fetch(
    `https://${SHOPIFY_STORE}.myshopify.com/admin/api/2024-01/blogs/${BLOG_ID}/articles.json`,
    {
      method: 'POST',
      headers: {
        'X-Shopify-Access-Token': SHOPIFY_TOKEN,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        article: {
          title: article.title,
          body_html: article.content,
          tags: article.tags.join(','),
          published: true,
          metafields: [{
            namespace: 'seo',
            key: 'description',
            value: article.metaDescription,
            type: 'single_line_text_field'
          }]
        }
      })
    }
  );

  return response.json();
}

Quality Control

Fully automated content generation risks publishing garbage. Our safeguards:

  • Duplicate detection — the system tracks all published titles and rejects similar ones
  • Minimum quality checks — word count, heading count, and readability score
  • Topic rotation — maintains a list of content categories and cycles through them
  • Manual review option — articles can be published as drafts for human review

Results After 3 Months

  • 90 blog posts published automatically
  • Organic traffic increased 45% from blog content
  • Zero hours of writing time per week
  • Cost: approximately $5/month for Gemini API calls

Should You Do This?

AI-generated blog content works best when:

  • You have a well-defined niche with specific topics
  • The content is informational (guides, tips, how-tos)
  • You supplement it with occasional human-written pieces
  • You monitor quality and prune underperforming posts

It's not a replacement for thought leadership or deeply technical content, but for the steady stream of SEO content that every e-commerce store needs, it's remarkably effective.

Related Project

AI-Powered Blog Automation

Daily SEO blog post generator that researches products with Google Search, writes authentic reviews using Gemini AI, and publishes directly to Shopify.