DEV Community

lufumeiying
lufumeiying

Posted on

GitHub Actions for Content Creators: Automate Your Publishing Workflow

GitHub Actions for Content Creators: Automate Your Publishing Workflow

Have you ever forgotten to publish an article on time?

Or spent hours manually checking your blog stats across multiple platforms?

What if I told you there's a free way to automate all of this - no server needed, no coding skills required?

Welcome to GitHub Actions, your new automation assistant.


🎯 What You'll Learn

graph LR
    A[Start Here] --> B[GitHub Basics]
    B --> C[Actions Setup]
    C --> D[Workflow Files]
    D --> E[Automation]
    E --> F[Success!]

    style A fill:#ffeb3b
    style F fill:#4caf50
Enter fullscreen mode Exit fullscreen mode

By the end of this guide, you'll know how to:

  1. ✅ Set up automated publishing schedules
  2. ✅ Create daily progress reports
  3. ✅ Track your content performance automatically
  4. ✅ Build a zero-maintenance workflow

🤔 Why GitHub Actions?

The Problem

Manual publishing is painful:

  • ⏰ Easy to forget schedules
  • 📊 Time-consuming data checks
  • 🔄 Repetitive tasks drain energy
  • 📱 Constant context switching

The Solution

GitHub Actions automates everything:

mindmap
  root((GitHub Actions))
    Publishing
      Scheduled posts
      Multi-platform
      Format conversion
    Monitoring
      Stats tracking
      Performance alerts
      Weekly reports
    Maintenance
      Backup content
      Update archives
      Clean unused files
Enter fullscreen mode Exit fullscreen mode

📊 GitHub Actions vs Other Tools

Feature GitHub Actions IFTTT Zapier Custom Script
Cost Free Free tier $20+/mo Server costs
Flexibility High Low Medium High
Learning curve Medium Easy Easy Hard
Maintenance Low Low Low High
Custom logic Full Limited Limited Full

Winner: GitHub Actions (free + flexible + low maintenance)


🚀 Quick Start Guide

Step 1: Understand the Basics

GitHub Actions = Automated workflows

Think of it as a robot that follows your instructions:

When: Something happens (time, event, etc.)
Do: A series of tasks
Where: GitHub's servers (free!)
Enter fullscreen mode Exit fullscreen mode

Step 2: Create Your First Workflow

File location: .github/workflows/publish.yml

name: Publish Daily Article

on:
  schedule:
    # Run every day at 10:00 UTC
    - cron: '0 10 * * *'

jobs:
  publish:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Setup Python
        uses: actions/setup-python@v5
        with:
          python-version: '3.11'

      - name: Install dependencies
        run: |
          pip install requests

      - name: Publish article
        env:
          DEVTO_API_KEY: ${{ secrets.DEVTO_API_KEY }}
        run: |
          python3 scripts/publish_article.py
Enter fullscreen mode Exit fullscreen mode

Step 3: Set Up Secrets

Secrets = Secure storage for passwords/tokens

graph TD
    A[GitHub Repository] --> B[Settings]
    B --> C[Secrets and variables]
    C --> D[Actions]
    D --> E[New repository secret]

    E --> F[Name: DEVTO_API_KEY]
    E --> G[Value: your-api-key]

    style A fill:#4caf50
    style G fill:#2196f3
Enter fullscreen mode Exit fullscreen mode

Steps:

  1. Go to repository Settings
  2. Click "Secrets and variables" → "Actions"
  3. Click "New repository secret"
  4. Add your API keys

📝 Practical Workflows

Workflow 1: Daily Publishing

Scenario: Publish one article every day at 10:00 AM

name: Daily Article Publisher

on:
  schedule:
    - cron: '0 10 * * *'  # 10:00 UTC daily
  workflow_dispatch:  # Manual trigger option

jobs:
  publish:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Setup Python
        uses: actions/setup-python@v5
        with:
          python-version: '3.11'

      - name: Get today's article
        id: article
        run: |
          # Find article for today
          ARTICLE=$(find content/articles -name "*.md" -newermt "$(date +%Y-%m-%d)" | head -1)
          echo "article_path=$ARTICLE" >> $GITHUB_OUTPUT

      - name: Publish to Dev.to
        if: steps.article.outputs.article_path != ''
        env:
          DEVTO_API_KEY: ${{ secrets.DEVTO_API_KEY }}
        run: |
          python3 scripts/publish_to_devto.py "${{ steps.article.outputs.article_path }}"

      - name: Notify success
        if: success()
        run: |
          curl -X POST "${{ secrets.TELEGRAM_WEBHOOK }}" \
            -d "message=✅ Article published successfully!"
Enter fullscreen mode Exit fullscreen mode

Workflow 2: Progress Reports

Scenario: Send morning and evening reports

name: Progress Reports

on:
  schedule:
    - cron: '0 0 * * *'   # 09:00 JST (00:00 UTC)
    - cron: '0 12 * * *'  # 21:00 JST (12:00 UTC)

jobs:
  morning-report:
    if: github.event.schedule == '0 0 * * *'
    runs-on: ubuntu-latest
    steps:
      - name: Generate morning report
        run: python3 scripts/generate_report.py --type=morning

      - name: Send to Telegram
        env:
          TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
        run: |
          python3 scripts/send_telegram.py --chat_id=${{ secrets.TELEGRAM_CHAT_ID }}

  evening-report:
    if: github.event.schedule == '0 12 * * *'
    runs-on: ubuntu-latest
    steps:
      - name: Generate evening report
        run: python3 scripts/generate_report.py --type=evening

      - name: Send to Telegram
        env:
          TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
        run: |
          python3 scripts/send_telegram.py --chat_id=${{ secrets.TELEGRAM_CHAT_ID }}
Enter fullscreen mode Exit fullscreen mode

Workflow 3: Data Tracking

Scenario: Track article performance hourly

name: Hourly Metrics Tracker

on:
  schedule:
    - cron: '0 * * * *'  # Every hour

jobs:
  track:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Fetch article metrics
        env:
          DEVTO_API_KEY: ${{ secrets.DEVTO_API_KEY }}
        run: |
          python3 scripts/fetch_metrics.py > metrics.json

      - name: Commit metrics
        run: |
          git config --local user.email "action@github.com"
          git config --local user.name "GitHub Action"
          git add metrics.json
          git diff --quiet && git diff --staged --quiet || git commit -m "chore: update metrics"
          git push
Enter fullscreen mode Exit fullscreen mode

🔧 Cron Schedule Cheatsheet

Common patterns:

# Every hour
- cron: '0 * * * *'

# Every day at specific time
- cron: '0 9 * * *'    # 09:00 UTC
- cron: '0 21 * * *'   # 21:00 UTC

# Multiple times per day
- cron: '0 9,12,18,21 * * *'  # 9AM, 12PM, 6PM, 9PM

# Every Monday
- cron: '0 9 * * 1'

# First day of month
- cron: '0 9 1 * *'
Enter fullscreen mode Exit fullscreen mode

Timezone conversion:

JST (UTC+9) to UTC:
09:00 JST = 00:00 UTC
21:00 JST = 12:00 UTC
Enter fullscreen mode Exit fullscreen mode

💡 Pro Tips

Tip 1: Use Workflow Dispatch

Problem: Sometimes you need to run manually

Solution: Add workflow_dispatch trigger

on:
  schedule:
    - cron: '0 10 * * *'
  workflow_dispatch:  # Enable manual trigger
    inputs:
      article_id:
        description: 'Article ID to publish'
        required: false
Enter fullscreen mode Exit fullscreen mode

Now you can trigger from GitHub UI!


Tip 2: Cache Dependencies

Problem: Installing packages every time is slow

Solution: Use caching

- name: Cache pip packages
  uses: actions/cache@v3
  with:
    path: ~/.cache/pip
    key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
    restore-keys: |
      ${{ runner.os }}-pip-
Enter fullscreen mode Exit fullscreen mode

Tip 3: Use Secrets Wisely

Never hardcode credentials!

# ❌ Bad
run: curl -H "api-key: abc123..."

# ✅ Good
env:
  API_KEY: ${{ secrets.API_KEY }}
run: curl -H "api-key: $API_KEY"
Enter fullscreen mode Exit fullscreen mode

Tip 4: Add Error Handling

- name: Publish article
  id: publish
  continue-on-error: true
  run: python3 scripts/publish.py

- name: Notify on failure
  if: failure() && steps.publish.outcome == 'failure'
  run: |
    curl -X POST "${{ secrets.SLACK_WEBHOOK }}" \
      -d '{"text": "❌ Publishing failed!"}'
Enter fullscreen mode Exit fullscreen mode

📊 Real-World Example

My Publishing Workflow:

graph TD
    A[Push to main branch] --> B[Run tests]
    B --> C{Tests pass?}
    C -->|Yes| D[Deploy to staging]
    C -->|No| E[Notify failure]
    D --> F[Manual approval]
    F --> G[Deploy to production]

    H[Daily at 10:00 UTC] --> I[Check for new articles]
    I --> J{New article?}
    J -->|Yes| K[Publish]
    J -->|No| L[Do nothing]
    K --> M[Send report]

    style A fill:#4caf50
    style K fill:#2196f3
    style M fill:#ff9800
Enter fullscreen mode Exit fullscreen mode

🎯 Monitoring Your Workflows

View Execution History

  1. Go to repository on GitHub
  2. Click "Actions" tab
  3. See all workflow runs

Debug Failed Runs

- name: Debug
  if: failure()
  run: |
    echo "Workflow failed!"
    echo "Job status: ${{ job.status }}"
    env  # Print all environment variables
Enter fullscreen mode Exit fullscreen mode

🚫 Common Mistakes

Mistake 1: Wrong Cron Syntax

# ❌ Wrong - runs every minute
- cron: '* * * * *'

# ✅ Correct - runs every hour
- cron: '0 * * * *'
Enter fullscreen mode Exit fullscreen mode

Mistake 2: Missing Secrets

# Always verify secrets exist
- name: Check secrets
  run: |
    if [ -z "${{ secrets.API_KEY }}" ]; then
      echo "API_KEY not set!"
      exit 1
    fi
Enter fullscreen mode Exit fullscreen mode

Mistake 3: No Error Handling

# ❌ Fails silently
- run: python3 script.py

# ✅ Handles errors
- name: Run script
  run: python3 script.py
  continue-on-error: false
Enter fullscreen mode Exit fullscreen mode

📈 Cost Analysis

Free Tier Limits

  • Public repos: Unlimited minutes
  • Private repos: 2,000 minutes/month
  • Storage: 500MB

Typical Usage

Workflow Runs/Month Minutes Cost
Daily publish 30 15 Free
Hourly check 720 360 Free
Reports (2x daily) 60 30 Free
Total 810 405 $0

Conclusion: Completely free for content creators!


🎓 Learning Path

Week 1: Basics

  • Day 1-2: Create first workflow
  • Day 3-4: Add scheduled triggers
  • Day 5-7: Test and debug

Week 2: Advanced

  • Day 1-3: Multi-step workflows
  • Day 4-5: Integration with APIs
  • Day 6-7: Error handling

Week 3: Optimization

  • Day 1-3: Caching and optimization
  • Day 4-5: Monitoring setup
  • Day 6-7: Documentation

🎬 Take Action

Your First Workflow

  1. Fork this template: github.com/example/publishing-workflow
  2. Add your secrets: API keys, tokens
  3. Enable workflows: Actions tab → enable
  4. Test manually: Run workflow → dispatch
  5. Monitor: Check execution logs

📝 Summary

mindmap
  root((GitHub Actions))
    Benefits
      Free automation
      No server needed
      Reliable execution
    Use Cases
      Scheduled publishing
      Progress reports
      Data tracking
    Key Features
      Cron schedules
      Secrets management
      Workflow dispatch
    Best Practices
      Use secrets
      Add error handling
      Cache dependencies
Enter fullscreen mode Exit fullscreen mode

💬 Final Thoughts

GitHub Actions isn't just for developers.

It's a powerful tool for anyone who creates content regularly. With zero cost and unlimited possibilities, there's no reason to continue doing manual work.

The best automation is the one you set up once and forget about.


What will you automate first? Share in the comments! 👇


Last updated: March 2026
All workflows tested and verified
No affiliate links or sponsored content

Top comments (0)