Skip to content

Repository files navigation

AI Article Generator

Automated AI content engine — fetches AI compliance news from authoritative sources, categorizes and expands them using OpenAI, and pushes MDX articles to any target site repository.

License: MIT Node.js OpenAI

What it does

AI Article Generator is a content automation engine that runs on GitHub Actions or locally. It:

  1. Fetches AI compliance news from the FrontOfAI Briefing API and configurable RSS feeds (FTC, EEOC, Google News alerts for EU AI Act, LL144, AI hiring bias, etc.)
  2. Categorizes each story using OpenAI (GPT-4o) — classifies as news vs. enforcement, assigns impact score, tags, and structured metadata
  3. Generates MDX articles — 800-1200 word news articles, enforcement action summaries, weekly roundups, and monthly trend analyses
  4. Publishes to any GitHub repository — clones the target repo, copies MDX files, commits, and pushes

Architecture

AI Article Generator                         Your Site Repo
     │                                            │
     ├─ Fetch FrontOfAI API                       │
     ├─ Fetch regulatory RSS feeds                │
     ├─ OpenAI categorize + expand                │
     ├─ Generate blog roundups                    │
     ├─ Generate trend analysis                   │
     │                                            │
     └── Push MDX files ──────────────────────► content/*.mdx
                                                      │
                                                      ▼
                                                Vercel/Netlify auto-deploys

Quick Start

1. Clone and install

git clone https://github.com/subodhkc/AI-Article-Generator.git
cd AI-Article-Generator
npm install

2. Configure environment variables

Copy .env.example to .env and fill in:

cp .env.example .env
  • OPENAI_API_KEY — Your OpenAI API key (for GPT-4o content generation)
  • TARGET_REPO_TOKEN — GitHub personal access token with repo scope (for pushing to your target site repo)

3. Configure your target site

Edit config/sites.json to point to your repository:

{
  "sites": [
    {
      "name": "my-blog",
      "repo": "your-username/your-blog-repo",
      "branch": "main",
      "contentPath": "src/content",
      "baseUrl": "https://yoursite.com",
      "siteName": "Your Site Name",
      "author": "Your Name",
      "authorRole": "AI Analyst",
      "logoPath": "/images/logo.png",
      "sponsorLink": "",
      "sponsorText": "",
      "internalLinks": ["/blog", "/guides", "/tools"],
      "categories": ["news", "enforcement", "blog", "trends"],
      "frontofaiCategories": ["governance-regulation", "security-riskwatch"],
      "categoryMapping": {
        "governance-regulation": "Compliance",
        "security-riskwatch": "AI Security",
        "enforcement": "Enforcement"
      },
      "minImpactScore": 6,
      "enabled": true
    }
  ]
}

4. Test locally (dry run)

npm test

This fetches 2 stories, generates articles, and writes them to output/ without pushing to your repo.

5. Run for real

npm run news      # Fetch + categorize + generate news articles
npm run weekly    # Generate weekly roundup blog post
npm run trends    # Generate monthly trend analysis

Configuration Reference

config/sites.json

Field Required Description
name Yes Unique identifier for the site (used in CLI --site= flag)
repo Yes GitHub repo in owner/repo format
branch Yes Branch to push to (e.g. main)
contentPath Yes Path in target repo where MDX files go (e.g. src/content)
baseUrl No Your site's base URL (used in prompts)
siteName No Your site's display name (injected into prompts via {{siteName}})
author No Author name in frontmatter (default: AI Content Engine)
authorRole No Author role in frontmatter
logoPath No Path to logo image for frontmatter
sponsorLink No Sponsor URL — if set with sponsorText, a contextual CTA is added to articles
sponsorText No Sponsor link text (e.g. "Get a professional AI compliance audit")
internalLinks No Array of internal link paths for articles to reference (e.g. ["/blog", "/guides"])
categories No Content categories to generate (default: news, enforcement, blog, trends)
frontofaiCategories No FrontOfAI API categories to fetch (default: governance-regulation, security-riskwatch)
categoryMapping No Map source categories to your site's categories
contentSubdir No If set, all articles go in this subdirectory instead of news/ and enforcement/
promptsDir No Custom prompts directory (falls back to prompts/ default)
minImpactScore No Minimum impact score (1-10) for stories (default: 6)
enabled Yes Set to true to include this site in generation runs

config/sources.json

Contains FrontOfAI API settings and RSS feed definitions. Add your own RSS feeds:

{
  "name": "My Custom Feed",
  "url": "https://example.com/rss.xml",
  "keywords": ["AI", "compliance", "regulation"],
  "category": "news"
}

To restrict a feed to specific sites only, add a "sites": ["site-name"] array.

Prompt customization

All prompts in prompts/ support placeholder tokens that get replaced with your site config values:

Placeholder Replaced with
{{siteName}} Your site's display name
{{baseUrl}} Your site's base URL
{{author}} Author name
{{authorRole}} Author role
{{sponsorLink}} Contextual sponsor CTA line (only if sponsorLink + sponsorText are set)
{{internalLinks}} Comma-separated markdown links from internalLinks array

To fully customize prompts for a specific site, set promptsDir in sites.json and create a directory with your own .txt prompt files. The engine checks your custom directory first, then falls back to the default prompts/ directory.

Content Types

News Articles (/news/)

  • Generated from FrontOfAI API and RSS feeds
  • 800-1200 words
  • Categorized with impact score, tags, source attribution
  • autoGenerated: true in frontmatter

Enforcement Actions (/enforcement/)

  • Stories classified as enforcement by OpenAI
  • Structured frontmatter: entity, violation, framework, penalty, region, status

Weekly Roundup Blog Posts (/blog/)

  • Generated every Monday
  • 1000-1500 words
  • Summarizes top 15 stories from the past week
  • Grouped by theme (regulatory, enforcement, industry)

Monthly Trend Analysis (/trends/)

  • Generated on the 1st of each month
  • 1500-2500 words
  • Analyzes patterns across 30+ stories from the past month
  • Identifies 3-5 key trends with evidence

GitHub Actions (Automated)

Four workflows are included:

Workflow Schedule Description
news-tracker.yml Every 4 hours Fetch FrontOfAI + RSS, categorize, generate news/enforcement articles
weekly-content.yml Every Monday 9:00 UTC Generate weekly roundup blog post
monthly-trends.yml 1st of month 10:00 UTC Generate monthly trend analysis
test-dry-run.yml Manual only Dry run — generates 2 articles without pushing

Set up GitHub Secrets

In your fork's Settings > Secrets and variables > Actions, add:

  • OPENAI_API_KEY — Your OpenAI API key
  • TARGET_REPO_TOKEN — GitHub token with write access to your target site repo(s)

All workflows can also be triggered manually via the GitHub Actions UI.

Content Rules

  • Uses ONLY source material from FrontOfAI API and RSS feeds — no fabrication
  • All AI-generated content is labeled with autoGenerated: true in frontmatter
  • Cites primary sources with links
  • Does not overwrite existing articles (skips if file exists)

Data Sources

FrontOfAI Briefing API

  • URL: https://frontofai.com/api/briefing/v1/stories
  • Free, no auth, 30 req/min
  • 39+ authoritative AI news sources
  • Categories: governance-regulation, security-riskwatch

RSS Feeds (configurable)

  • FTC press releases
  • EEOC newsroom
  • Google News alerts for LL144, EU AI Act, AI hiring bias, AI audit, AI app security, prompt injection, OWASP LLM Top 10, and more

Need Help with Custom Setup?

This tool is designed to be self-service, but if you need help with:

  • Custom integration with your existing CMS or site framework
  • Custom prompts tuned for your industry or audience
  • Additional RSS sources or data feeds
  • Multi-site deployment at scale
  • Vercel/Netlify auto-deploy configuration

Contact Subodh KC for consulting and custom setup services.

Adding New Sites

  1. Add site config to config/sites.json
  2. Create a GitHub token with write access to the new repo
  3. Add the token as a GitHub secret (or reuse TARGET_REPO_TOKEN)
  4. Run node scripts/publish.mjs --mode=news --site=your-site-name

License

MIT — see LICENSE

About

Generates Article for your business

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages