DEV Community

S Gr
S Gr

Posted on

How to Build a Self-Updating AI News Digest Using GitHub Actions and OpenAI API

How to Build a Self-Updating AI News Digest Using GitHub Actions and OpenAI API

This article mentions a tool I use; the link at the end is an affiliate link.

One of the most practical AI automation projects you can build in 2026 is a self-updating newsletter digest that runs entirely on free infrastructure. This tutorial walks you through creating an automated system that scrapes tech news, summarizes it with AI, and generates a weekly digest—all without a server.

Why This Project Works as a Side Hustle

Unlike vague "make money with AI" schemes, this creates a tangible asset: an email list that receives valuable, curated content. You can monetize through sponsorships, affiliate partnerships, or premium tiers once you hit 500+ subscribers. The automation runs free on GitHub Actions (2,000 minutes/month free tier).

What You'll Build

A Python script that:

  1. Fetches RSS feeds from tech news sources
  2. Uses OpenAI API to summarize articles
  3. Generates a formatted HTML digest
  4. Sends via email API
  5. Runs automatically every Monday at 8 AM via GitHub Actions

Prerequisites

  • GitHub account (free)
  • OpenAI API key ($5 credit gets you started)
  • Resend.com account (free tier: 100 emails/day)
  • Basic Python knowledge

Step 1: Set Up Your Repository

Create a new GitHub repository and clone it locally:

git clone https://github.com/yourusername/ai-news-digest.git
cd ai-news-digest
Enter fullscreen mode Exit fullscreen mode

Create this file structure:

ai-news-digest/
├── .github/
│   └── workflows/
│       └── digest.yml
├── src/
│   ├── fetch_news.py
│   ├── summarize.py
│   └── send_email.py
├── requirements.txt
└── README.md
Enter fullscreen mode Exit fullscreen mode

Step 2: Build the News Fetcher

Create src/fetch_news.py:

import feedparser
import json
from datetime import datetime, timedelta

RSS_FEEDS = [
    'https://news.ycombinator.com/rss',
    'https://techcrunch.com/feed/',
    'https://www.theverge.com/rss/index.xml'
]

def fetch_recent_articles(days=7):
    cutoff_date = datetime.now() - timedelta(days=days)
    articles = []

    for feed_url in RSS_FEEDS:
        feed = feedparser.parse(feed_url)
        for entry in feed.entries[:10]:
            pub_date = datetime(*entry.published_parsed[:6])
            if pub_date > cutoff_date:
                articles.append({
                    'title': entry.title,
                    'link': entry.link,
                    'summary': entry.summary[:200],
                    'published': pub_date.isoformat()
                })

    return sorted(articles, key=lambda x: x['published'], reverse=True)[:15]
Enter fullscreen mode Exit fullscreen mode

Step 3: Add AI Summarization

Create src/summarize.py:

import openai
import os

openai.api_key = os.environ.get('OPENAI_API_KEY')

def create_digest(articles):
    article_text = "\n\n".join([
        f"Title: {a['title']}\nSummary: {a['summary']}"
        for a in articles
    ])

    prompt = f"""Create a brief, engaging weekly tech digest from these articles.
    Group by theme (AI, startups, dev tools, etc.). Keep it under 400 words.

    Articles:
    {article_text}
    """

    response = openai.chat.completions.create(
        model="gpt-4o-mini",
        messages=[{"role": "user", "content": prompt}],
        max_tokens=600
    )

    return response.choices[0].message.content
Enter fullscreen mode Exit fullscreen mode

Step 4: Email Delivery

Create src/send_email.py using Resend:

import resend
import os

resend.api_key = os.environ.get('RESEND_API_KEY')

def send_digest(digest_content, recipients):
    html_content = f"""
    <html>
    <body style="font-family: Arial, sans-serif; max-width: 600px; margin: 0 auto;">
        <h1>Your Weekly Tech Digest</h1>
        <div>{digest_content}</div>
        <hr>
        <p style="color: #666; font-size: 12px;">Unsubscribe link here</p>
    </body>
    </html>
    """

    resend.Emails.send({
        "from": "digest@yourdomain.com",
        "to": recipients,
        "subject": f"Tech Digest - {datetime.now().strftime('%B %d, %Y')}",
        "html": html_content
    })
Enter fullscreen mode Exit fullscreen mode

Step 5: GitHub Actions Automation

Create .github/workflows/digest.yml:

name: Weekly Digest
on:
  schedule:
    - cron: '0 8 * * 1'
  workflow_dispatch:

jobs:
  generate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-python@v4
        with:
          python-version: '3.11'
      - run: pip install -r requirements.txt
      - run: python main.py
        env:
          OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
          RESEND_API_KEY: ${{ secrets.RESEND_API_KEY }}
Enter fullscreen mode Exit fullscreen mode

Add your API keys to GitHub Settings → Secrets → Actions.

Step 6: Growing Your Subscriber List

When I was setting up the subscriber management piece, I found that handling the landing page and email collection flow was more complex than expected. I used Perpetual Income 365 to handle the opt-in forms and initial automation sequences, which saved me about a week of setup time. It provided pre-built templates that integrated with the digest system.

Alternatively, you can use:

  • Buttondown (free for 100 subscribers)
  • ConvertKit (free tier available)
  • Custom landing page with Supabase for storage

Monetization Timeline

Weeks 1-4: Share on Reddit, Twitter, dev communities. Goal: 50 subscribers.

Months 2-3: Consistent quality builds to 200-500 subscribers. Start reaching out to tool companies for sponsorships ($50-200/issue).

Month 6+: With 1,000+ subscribers, you can charge $300-500 per sponsored mention or create a premium tier.

Real Costs

  • OpenAI API: ~$2-5/month for 4 digests
  • Domain: $12/year
  • Email service: Free tier sufficient until 500+ subscribers

Next Steps

Test your workflow manually first with workflow_dispatch. Monitor your GitHub Actions usage. The key is consistency—publish every week for at least 12 weeks before evaluating traction.

This isn't a get-rich-quick scheme. It's a legitimate automation project that builds a real asset over 6-12 months. The code runs itself; your job is creating distribution channels and maintaining quality.


Affiliate Disclosure: The link below to Perpetual Income 365 is an affiliate link, meaning I may earn a commission if you purchase through it, at no additional cost to you.


The tool mentioned above is an affiliate link (disclosed at top): Perpetual Income 365

Top comments (0)