How I Built an AI News Summarizer with Hugging Face and GitHub Actions (Beginner-Friendly)

robot reading news on a laptop with a cloud upload symbol

Meta Description: Learn how to build a AI news bot that summarizes top headlines using Hugging Face Transformers and sends them to Discord daily — no prior experience needed! Everything runs for free using GitHub Actions.

Are you tired of checking AI news manually every day? I was too. So, I built a simple system that finds news, summarizes it using AI, and sends it straight to my Discord. No coding experience? Don’t worry — this guide is for beginners. You’ll learn step-by-step how to build your own AI-powered news assistant using easy tools like Hugging Face, GitHub, and Discord. Let’s get started!

Why I Built This News Agent (And You Can Too)

I love staying updated with new things in Artificial Intelligence (AI). But searching through blogs and websites every day takes time. That’s why I created a smart helper — an AI bot that finds the latest AI news, summarizes it, and sends it to me. You can use the same idea for anything — tech news, sports updates, or even daily quotes.

Tools You’ll Use (All Free & Beginner-Friendly)

Here’s what you’ll need — don’t worry, I’ll explain each one:

  • Hugging Face Transformers: A free library that uses powerful AI models. We’ll use it to summarize news into short, simple text.
  • RSS Feeds: This is how we get the latest news. Think of it like a stream of headlines from news websites.
  • GitHub Actions: This is how we make everything run automatically every day.
  • Discord Webhook: This lets your bot send messages directly to your Discord channel.

Full Python Code

Name this file as news_bot.py

# Step 1: Import required libraries

import feedparser  # To fetch news from RSS feeds

import requests     # To send messages to Discord

from transformers import pipeline  # To summarize articles

import os           # To get environment variable for webhook URL

# Step 2: Get the latest news from RSS

def get_news():

    # Using Google News RSS for "Artificial Intelligence"

    url = "https://news.google.com/rss/search?q=artificial+intelligence"

    feed = feedparser.parse(url)

    # Get top 3 news entries with their title and summary

    articles = [entry.title + ". " + entry.summary for entry in feed.entries[:3]]

    return articles

# Step 3: Summarize news articles using Hugging Face model

def summarize_articles(articles):

    # Load summarization pipeline with a pre-trained model

    summarizer = pipeline("summarization", model="facebook/bart-large-cnn")

    summaries = []

    for article in articles:

        summary = summarizer(article, max_length=100, min_length=30, do_sample=False)[0]['summary_text']

        summaries.append(summary)

    return summaries

# Step 4: Send summaries to Discord via webhook

def send_to_discord(summaries):

    webhook_url = os.environ.get("DISCORD_WEBHOOK_URL")  # Fetch webhook from GitHub secret

    content = "**\U0001F4F0 Daily AI News Digest:**\n\n"

    for s in summaries:

        content += f"- {s}\n\n"

    requests.post(webhook_url, json={"content": content})

# Step 5: Combine everything and run the bot

if __name__ == "__main__":

    articles = get_news()                      # Fetch news

    summaries = summarize_articles(articles)  # Summarize them

    send_to_discord(summaries)                # Send to Discord

How to Get Your Discord Webhook URL

  1. Open your Discord server.
  2. Go to the channel where you want the news to be posted.
  3. Click the ⚙️ gear icon next to the channel name.
  4. Select Integrations > Webhooks.
  5. Click New Webhook.
  6. Name your webhook and select the channel to post in.
  7. Click Copy Webhook URL — this is what you’ll save in GitHub Secrets.

Set Your Webhook URL as a GitHub Secret

  1. Go to your GitHub repo → SettingsSecrets and variablesActions.
  2. Click New repository secret.
  3. Name it DISCORD_WEBHOOK_URL
  4. Paste your actual Discord webhook URL as the value.

Schedule It with GitHub Actions

Create a file in your repo: .github/workflows/news.yml

name: AI News Bot

on:

  schedule:

    - cron: '0 8 * * *' # Runs every day at 8:00 AM UTC

  workflow_dispatch:   

jobs:

  run:

    runs-on: ubuntu-latest

    steps:

      - name: Checkout code

        uses: actions/checkout@v3

      - name: Set up Python

        uses: actions/setup-python@v3

        with:

          python-version: '3.9'

      - name: Install dependencies

        run: |

          pip install torch==2.1.0+cpu torchvision==0.16.0+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html

          pip install transformers feedparser requests

      - name: Run the script

        env:

          DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}

        run: python news_bot.py

Make sure your script file is named news_bot.py and your webhook is set in repo secrets.

What You’ll Get (Final Result)

Every morning, you’ll see a clean summary like this in your Discord:

**📰 Daily AI News Digest:**

- OpenAI launches GPT-5 preview for select users...

- Hugging Face releases new free inference tools...

- MIT researchers create a model that explains itself..

Now you have your own smart news bot. You can modify it for different topics or even post to Twitter instead. Want more guides like this? Check out our LangChain Chatbot Tutorial and Secret Prompt Engineering Tips!

FAQs About Building an AI News Summarizer

  • A tool that lets your code run on a schedule — like a robot that does things for you every day.

  • Yes! All tools used here (Hugging Face, GitHub, Discord) have free versions that are enough for personal use.

  • Not much. You can copy-paste most of the code. Just follow the steps slowly — it’s very beginner-friendly.

Previous Article

LangChain Chatbot Development: A Practical Tutorial for Beginners

Next Article

Top 4 Free AI Customer Service Tools for Shopify & WooCommerce That Boost Sales (2025)

Write a Comment

Leave a Comment

Your email address will not be published. Required fields are marked *