Skip to content

Daily Bot Cron

Daily Bot Cron #124

Workflow file for this run

name: Daily Bot Cron
on:
schedule:
- cron: '0 4 * * *' # Run daily at 4 AM UTC
workflow_dispatch: # Allows manual trigger from GitHub UI
jobs:
run-bot:
runs-on: ubuntu-latest
timeout-minutes: 15 # Prevent hanging jobs
# if: github.ref == 'refs/heads/main' # Only run on main branch
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Cache pip dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --no-cache-dir -r requirements.txt
- name: Verify installation
run: |
python --version
pip list
- name: Run the bot
run: |
python src/run.py
env:
# Twitter/X API credentials
BEARER_TOKEN: ${{ secrets.BEARER_TOKEN }}
CONSUMER_KEY: ${{ secrets.CONSUMER_KEY }}
CONSUMER_SECRET: ${{ secrets.CONSUMER_SECRET }}
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
ACCESS_TOKEN_SECRET: ${{ secrets.ACCESS_TOKEN_SECRET }}
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
# Bot configuration
BASE_URL: ${{ secrets.BASE_URL }}
FORMAT: ${{ secrets.FORMAT }}
ORDER: ${{ secrets.ORDER }}
# Optional: Uncomment if needed
# LOG_LEVEL: ${{ secrets.LOG_LEVEL }}
# LOG_FILE: ${{ secrets.LOG_FILE }}
# OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
# META_API_KEY: ${{ secrets.META_API_KEY }}
# - name: Upload logs on failure
# if: failure()
# uses: actions/upload-artifact@v4
# with:
# name: bot-logs-${{ github.run_number }}
# path: |
# logs/
# *.log
# retention-days: 7
# - name: Report status
# if: always()
# run: |
# if [ ${{ job.status }} == 'success' ]; then
# echo " Bot ran successfully at $(date)"
# else
# echo "Bot failed at $(date)"
# fi