Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# UnionLedger Environment Variables
# Copy this file to .env and fill in your actual values

# Telegram Configuration
TELEGRAM_BOT_TOKEN=your_telegram_bot_token_here
TELEGRAM_CHAT_ID=your_telegram_chat_id_here

# Discord Configuration
DISCORD_WEBHOOK_URL=your_discord_webhook_url_here

# WhatsApp Configuration
WHATSAPP_TOKEN=your_whatsapp_token_here
WHATSAPP_PHONE_ID=your_whatsapp_phone_id_here
WHATSAPP_TO_NUMBER=your_whatsapp_number_here

# Auto-Posting Script Configuration (for GLOBAL SPORTS WATCH)
# Get your Gemini API key from: https://ai.google.dev/
GEMINI_API_KEY=your_gemini_api_key_here

# OpenAI API key (fallback) from: https://platform.openai.com/
OPENAI_API_KEY=your_openai_api_key_here

# RSS Feed URL for contributor content
RSS_FEED_URL=https://example.com/sports/feed.xml

# Ko-fi API key for tier-based features
KOFI_API_KEY=your_kofi_api_key_here

# Optional: Maximum number of RSS entries to process (default: 10)
MAX_RSS_ENTRIES=10
102 changes: 102 additions & 0 deletions .github/workflows/auto-post.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: 🤖 Auto-Post Sports Content

on:
schedule:
# Run every 6 hours
- cron: '0 */6 * * *'

# Allow manual triggering
workflow_dispatch:
inputs:
dry_run:
description: 'Run in dry-run mode (no actual posting)'
required: false
default: 'false'

jobs:
auto-post:
runs-on: ubuntu-latest

# Limit permissions for security
permissions:
contents: read

steps:
- name: ⬇️ Checkout code
uses: actions/checkout@v3

- name: 🐍 Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'

- name: 📦 Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: 🔐 Validate API keys
env:
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: |
if [ -z "$GEMINI_API_KEY" ] && [ -z "$OPENAI_API_KEY" ]; then
echo "❌ Error: No API keys configured"
echo "Please add GEMINI_API_KEY or OPENAI_API_KEY to repository secrets"
exit 1
fi

if [ -n "$GEMINI_API_KEY" ]; then
echo "✅ Gemini API key configured"
fi

if [ -n "$OPENAI_API_KEY" ]; then
echo "✅ OpenAI API key configured (fallback)"
fi

- name: 🚀 Run auto-posting script
env:
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
RSS_FEED_URL: ${{ secrets.RSS_FEED_URL }}
KOFI_API_KEY: ${{ secrets.KOFI_API_KEY }}
run: |
echo "🤖 Starting auto-posting workflow..."
python auto_post.py

- name: 📊 Display summary
if: always()
run: |
echo "📝 Processing Summary:"
if [ -f "publishing_audit.json" ]; then
echo "Total actions logged: $(cat publishing_audit.json | grep -o '"action"' | wc -l)"
echo "Successful posts: $(cat publishing_audit.json | grep -o '"success": true' | wc -l)"
echo "Failed posts: $(cat publishing_audit.json | grep -o '"success": false' | wc -l)"
else
echo "⚠️ No audit log generated"
fi

- name: 📤 Upload audit logs
uses: actions/upload-artifact@v3
if: always()
with:
name: audit-logs-${{ github.run_number }}
path: |
auto_post_audit.log
publishing_audit.json
overlay_*.xml
retention-days: 30

- name: 🔔 Notify on failure
if: failure()
run: |
echo "❌ Auto-posting workflow failed"
echo "Check the logs for details"
# Optional: Add notification via Discord/Slack/Email here

- name: ✅ Success notification
if: success()
run: |
echo "✅ Auto-posting completed successfully"
echo "🎯 Check artifacts for detailed logs"
35 changes: 34 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,45 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Auto-posting logs and generated files
auto_post_audit.log
publishing_audit.json
overlay_*.xml

# Python cache
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# Environment files (local configs)
/.env.*

# Node.js dependencies
node_modules/
package-lock.json
# 🔐 Environment files

# 🔐 Environment files (exclude .env but allow .env.example)
.env
!.env.example
backend/.env

# Test files (optional - remove if you want to include them)
# test-*.html
# test-*.sh
Loading