Back to .md Directory

๐Ÿš€ Daily Tech News Email Workflow

> **Automated GitHub Actions workflow that delivers the latest technology news directly to your inbox every day.**

May 2, 2026
0 downloads
0 views
ai workflow
View source

๐Ÿš€ Daily Tech News Email Workflow

Automated GitHub Actions workflow that delivers the latest technology news directly to your inbox every day.

GitHub Actions Python NewsAPI License


๐Ÿ“– Overview

Daily Tech News Email Workflow is a fully automated solution that keeps you updated with the latest technology news without lifting a finger. Using GitHub Actions, this workflow runs daily, fetches top technology headlines from NewsAPI.org, and delivers them to your email as a beautifully formatted HTML newsletter.

Perfect for developers, tech enthusiasts, and anyone who wants to stay informed about the latest tech trends without manually checking news sites.


โœจ Features

  • ๐Ÿ“ฐ Automated Daily Updates - Runs automatically every day at 8:00 AM UTC (1:30 PM IST)
  • ๐Ÿ“ง Beautiful HTML Emails - Professional, responsive email design with modern styling
  • ๐ŸŽจ Rich Formatting - Includes article titles, descriptions, sources, and publication dates
  • ๐Ÿ”— Clickable Links - Direct links to full articles for easy reading
  • ๐Ÿ”’ Secure - Uses GitHub Secrets for credential management
  • ๐Ÿ†“ Free - Uses free tier APIs (NewsAPI.org)
  • โšก Fast - Delivers news within seconds of scheduled run
  • ๐Ÿ› ๏ธ Customizable - Easy to modify schedule, news categories, and email design
  • ๐Ÿ“ฑ Multi-Provider Support - Works with Gmail, Outlook, Yahoo, and other SMTP providers
  • ๐ŸŽฏ Manual Trigger - Run on-demand anytime via GitHub Actions

๐ŸŽฏ How It Works

graph LR
    A[GitHub Actions<br/>Scheduled Trigger] --> B[Fetch News<br/>from NewsAPI]
    B --> C[Format HTML<br/>Email Template]
    C --> D[Send via<br/>SMTP]
    D --> E[๐Ÿ“ง Email Inbox]
    
    style A fill:#2563eb
    style E fill:#16a34a
  1. GitHub Actions triggers the workflow daily at a scheduled time
  2. Python script fetches the latest technology headlines from NewsAPI.org
  3. HTML template formats the news into a beautiful email newsletter
  4. SMTP client sends the email to your configured recipient address
  5. You receive the latest tech news in your inbox!

๐Ÿš€ Quick Start

Prerequisites

  • GitHub account
  • Email account (Gmail, Outlook, or Yahoo)
  • NewsAPI.org account (free tier)

Installation

  1. Fork or clone this repository

    git clone https://github.com/Tharinda-Pamindu/news_updater.git
    cd news_updater
    
  2. Get your NewsAPI key

  3. Set up GitHub Secrets

    Go to your repository โ†’ Settings โ†’ Secrets and variables โ†’ Actions โ†’ New repository secret

    Add these 4 secrets:

    Secret NameDescriptionExample
    NEWS_API_KEYYour NewsAPI.org API keyabc123def456...
    EMAIL_USERNAMEYour SMTP email addressyou@gmail.com
    EMAIL_PASSWORDEmail app passwordabcd efgh ijkl mnop
    RECIPIENT_EMAILWhere to receive newsyou@gmail.com
  4. Enable GitHub Actions

    • Go to Actions tab in your repository
    • Enable workflows if prompted
  5. Test the workflow

    • Go to Actions โ†’ Daily Tech News Email
    • Click "Run workflow" โ†’ "Run workflow"
    • Check your email inbox!

๐Ÿ“ง Email Preview

The newsletter includes:

  • ๐Ÿ“ฐ Top 10 Technology Headlines - Latest and most relevant tech news
  • ๐Ÿ”— Direct Article Links - Click to read full articles
  • ๐Ÿ“… Publication Dates - Know when news was published
  • ๐Ÿข Source Attribution - See which publication reported the news
  • ๐ŸŽจ Modern Design - Clean, professional layout with brand colors

โš™๏ธ Configuration

Change Schedule

Edit .github/workflows/daily-tech-news.yml line 6:

schedule:
  - cron: '0 8 * * *'  # 8:00 AM UTC daily

Popular schedules:

  • '0 0 * * *' - Midnight UTC (5:30 AM IST)
  • '0 12 * * *' - Noon UTC (5:30 PM IST)
  • '0 8 * * 1-5' - 8 AM UTC, weekdays only
  • '0 0 * * 1' - Monday mornings only

Use crontab.guru to create custom schedules.

Change News Category

Edit fetch_news.py line 24:

params = {
    "category": "technology",  # Options: business, science, health, entertainment, sports
    "language": "en",
    "pageSize": 10,
    "apiKey": api_key
}

Change Number of Articles

Modify pageSize (max 100 for free tier):

"pageSize": 15,  # Get 15 articles instead of 10

๐Ÿ”ง Local Testing

Test the workflow locally before deploying:

  1. Create .env file

    cp .env.example .env
    
  2. Add your credentials to .env

    NEWS_API_KEY=your_newsapi_key
    EMAIL_USERNAME=your_email@gmail.com
    EMAIL_PASSWORD=your_app_password
    RECIPIENT_EMAIL=your_email@gmail.com
    
  3. Install dependencies

    pip install -r requirements.txt
    
  4. Run the script

    python fetch_news.py
    
  5. Check your email!


๐Ÿ” Gmail App Password Setup

If using Gmail, you must use an App Password:

  1. Enable 2-Factor Authentication on your Google account
  2. Go to myaccount.google.com/apppasswords
  3. Select Mail and Other (Custom name)
  4. Enter "GitHub Actions" as the name
  5. Click Generate
  6. Copy the 16-character password (remove spaces)
  7. Use this as your EMAIL_PASSWORD secret

๐Ÿ“ Project Structure

news_updater/
โ”œโ”€โ”€ .github/
โ”‚   โ””โ”€โ”€ workflows/
โ”‚       โ””โ”€โ”€ daily-tech-news.yml    # GitHub Actions workflow
โ”œโ”€โ”€ fetch_news.py                   # Main Python script
โ”œโ”€โ”€ requirements.txt                # Python dependencies
โ”œโ”€โ”€ .env.example                    # Environment variables template
โ”œโ”€โ”€ .gitignore                      # Git ignore rules
โ””โ”€โ”€ README.md                       # This file

๐Ÿ› ๏ธ Technologies Used

  • GitHub Actions - Workflow automation and scheduling
  • Python 3.11+ - Script execution
  • NewsAPI.org - News aggregation API
  • SMTP - Email delivery protocol
  • HTML/CSS - Email template design

๐Ÿ“Š API Usage

NewsAPI.org Free Tier:

  • โœ… 100 requests per day
  • โœ… Top headlines access
  • โœ… Multiple categories
  • โœ… 30 days of historical data

Email Sending:

  • โœ… Unlimited emails via SMTP
  • โœ… No API limits
  • โœ… Works with any SMTP provider

๐Ÿ› Troubleshooting

Workflow Not Running

  • โœ“ Check GitHub Actions is enabled in repository settings
  • โœ“ Verify workflow file is in .github/workflows/ directory
  • โœ“ Check Actions tab for error messages

Email Not Received

  • โœ“ Verify all 4 GitHub secrets are set correctly
  • โœ“ Check spam/junk folder
  • โœ“ For Gmail: Ensure you're using App Password, not regular password
  • โœ“ Review workflow logs for SMTP errors

API Errors

  • โœ“ Verify NewsAPI key is valid at newsapi.org/account
  • โœ“ Check you haven't exceeded 100 requests/day limit
  • โœ“ Ensure NEWS_API_KEY secret is set correctly

SMTP Authentication Failed

  • โœ“ Gmail: Must use App Password with 2FA enabled
  • โœ“ Outlook: Check "Less secure app access" settings
  • โœ“ Yahoo: Use app-specific password
  • โœ“ Verify EMAIL_USERNAME and EMAIL_PASSWORD are correct

๐ŸŽจ Customization Ideas

  • Multiple Recipients - Modify script to send to multiple emails
  • Different Time Zones - Adjust cron schedule for your timezone
  • Custom Categories - Mix business, science, and tech news
  • Weekly Digest - Change schedule to run once per week
  • Custom Styling - Modify HTML template colors and layout
  • Add Images - Include article images in email (requires API upgrade)

๐Ÿค Contributing

Contributions are welcome! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“ License

This project is licensed under the MIT License - see the LICENSE file for details.


๐Ÿ™ Acknowledgments


๐Ÿ“ž Support

If you encounter any issues or have questions:

  1. Check the Troubleshooting section
  2. Review GitHub Actions logs
  3. Open an issue

๐ŸŒŸ Show Your Support

If you find this project useful, please consider:

  • โญ Starring the repository
  • ๐Ÿด Forking for your own use
  • ๐Ÿ“ข Sharing with others
  • ๐Ÿ› Reporting bugs
  • ๐Ÿ’ก Suggesting new features

<div align="center">

Made with โค๏ธ by Tharinda Pamindu

Stay informed. Stay ahead.

</div>

โœจ Features

  • ๐Ÿ“ฐ Fetches top 10 technology headlines from NewsAPI.org
  • ๐Ÿ“ง Sends formatted HTML email newsletter
  • โฐ Runs automatically every day at 8:00 AM UTC
  • ๐ŸŽจ Beautiful, responsive email design
  • ๐Ÿ”ง Easy to customize and configure
  • ๐Ÿ†“ Uses free tier APIs

๐Ÿ› ๏ธ Setup Instructions

1. Get a NewsAPI Key

  1. Visit NewsAPI.org
  2. Sign up for a free account
  3. Copy your API key (free tier includes 100 requests/day)

2. Configure GitHub Secrets

Add the following secrets to your GitHub repository:

  1. Go to your repository on GitHub
  2. Click Settings โ†’ Secrets and variables โ†’ Actions
  3. Click New repository secret and add each of the following:
Secret NameDescriptionExample
NEWS_API_KEYYour NewsAPI.org API keyabc123def456...
EMAIL_USERNAMEYour SMTP email addressyourname@gmail.com
EMAIL_PASSWORDYour email app passwordabcd efgh ijkl mnop
RECIPIENT_EMAILEmail where you want to receive newsyourname@gmail.com

3. Email Provider Setup

For Gmail Users (Recommended)

[!IMPORTANT] Gmail requires an App Password instead of your regular password.

  1. Enable 2-Factor Authentication on your Google account
  2. Go to Google App Passwords
  3. Select Mail and Other (Custom name)
  4. Enter "GitHub Actions" as the name
  5. Click Generate
  6. Copy the 16-character password (remove spaces)
  7. Use this as your EMAIL_PASSWORD secret

For Outlook/Hotmail Users

  1. Use your regular Outlook email and password
  2. Make sure "Less secure app access" is enabled if required

For Yahoo Users

  1. Generate an app password from Yahoo Account Security
  2. Use the app password as your EMAIL_PASSWORD

4. Customize Schedule (Optional)

The workflow runs daily at 8:00 AM UTC by default. To change this:

  1. Open .github/workflows/daily-tech-news.yml
  2. Modify the cron expression:
schedule:
  - cron: '0 8 * * *'  # Format: minute hour day month day-of-week

Examples:

  • '0 12 * * *' - Noon UTC (12:00 PM)
  • '30 6 * * *' - 6:30 AM UTC
  • '0 0 * * 1' - Midnight UTC every Monday

[!TIP] Use crontab.guru to help create cron expressions.

5. Test the Workflow

Manual Trigger

  1. Go to your repository on GitHub
  2. Click Actions tab
  3. Select Daily Tech News Email workflow
  4. Click Run workflow โ†’ Run workflow
  5. Wait for the workflow to complete
  6. Check your email inbox

View Logs

  1. Click on the workflow run
  2. Click on the send-tech-news job
  3. Expand each step to see detailed logs

๐Ÿงช Local Testing

To test the script locally before deploying:

  1. Clone the repository:
git clone <your-repo-url>
cd news_updates
  1. Create a .env file from the example:
cp .env.example .env
  1. Edit .env and add your credentials:
NEWS_API_KEY=your_actual_api_key
EMAIL_USERNAME=your_email@gmail.com
EMAIL_PASSWORD=your_app_password
RECIPIENT_EMAIL=your_email@gmail.com
  1. Install dependencies:
pip install -r requirements.txt
  1. Run the script:
python fetch_news.py

๐Ÿ“ง Email Preview

The email newsletter includes:

  • ๐Ÿ“ฐ Top 10 technology headlines
  • ๐Ÿ”— Clickable article links
  • ๐Ÿ“… Publication dates and times
  • ๐Ÿข News source attribution
  • ๐ŸŽจ Clean, modern design

๐Ÿ”ง Troubleshooting

Workflow Not Running

  • Check that the workflow file is in .github/workflows/ directory
  • Verify GitHub Actions is enabled in repository settings
  • Check the Actions tab for any error messages

Email Not Received

  • Verify all GitHub secrets are set correctly
  • Check spam/junk folder
  • Review workflow logs for error messages
  • For Gmail: Ensure you're using an App Password, not your regular password
  • Test with manual workflow trigger first

API Errors

  • Verify your NewsAPI key is valid
  • Check you haven't exceeded the free tier limit (100 requests/day)
  • Ensure the API key is correctly set in GitHub secrets

SMTP Authentication Failed

  • Gmail: Must use App Password with 2FA enabled
  • Outlook: Check if "Less secure app access" needs to be enabled
  • Yahoo: Use app-specific password
  • Verify EMAIL_USERNAME and EMAIL_PASSWORD are correct

๐ŸŽจ Customization

Change News Category

Edit fetch_news.py and modify the API parameters:

params = {
    "category": "technology",  # Change to: business, science, health, etc.
    "language": "en",
    "pageSize": 10,
    "apiKey": api_key
}

Change Number of Articles

Modify pageSize in the API parameters (max: 100 for free tier):

"pageSize": 15,  # Get 15 articles instead of 10

Customize Email Design

Edit the HTML template in the create_html_email() function in fetch_news.py.

๐Ÿ“ License

This project is open source and available under the MIT License.

๐Ÿค Contributing

Contributions, issues, and feature requests are welcome!

๐Ÿ“ฌ Support

If you encounter any issues, please check the troubleshooting section or open an issue on GitHub.


Powered by:

Related Documents