Daily GhostBot Upload #326
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Daily GhostBot Upload | |
| on: | |
| schedule: | |
| - cron: '0 18 * * *' | |
| workflow_dispatch: | |
| concurrency: | |
| group: ghostbot-upload | |
| cancel-in-progress: false | |
| jobs: | |
| run_bot: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 360 | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| cache: 'pip' | |
| # NEW: Sets up the Node.js environment required for Puter.js | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' | |
| - name: Install System Dependencies & Fix Permissions | |
| run: | | |
| sudo apt-get update | |
| # CRITICAL FIX RESTORED: Added libwebp-dev, libjpeg-dev, zlib1g-dev, libfreetype6-dev | |
| # These are required by Pillow and OpenCV in Phase 2 & 3 to prevent black screens/crashes. | |
| sudo apt-get install -y ffmpeg libsndfile1 sox imagemagick fonts-liberation ghostscript \ | |
| libwebp-dev libjpeg-dev zlib1g-dev libfreetype6-dev | |
| # Loosens ImageMagick security policies to prevent MoviePy text/image generation crashes | |
| sudo sed -i '/<policy domain="path" rights="none" pattern="@\*"/d' /etc/ImageMagick-6/policy.xml || true | |
| # Prevents Error 13 (Permission denied) when saving dynamic assets | |
| mkdir -p assets temp images downloads | |
| chmod -R 777 assets temp images downloads | |
| - name: Install Python Libraries | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install torch torchaudio --index-url https://download.pytorch.org/whl/cpu | |
| # CRITICAL FIX: Explicitly installing the Phase 3 libraries (transformers, opencv, imageio) | |
| # to guarantee the Parallax engine works flawlessly. | |
| pip install google-api-python-client requests Pillow scipy moviepy \ | |
| opencv-python-headless imageio[ffmpeg] imageio[pyav] transformers | |
| pip install -r requirements.txt | |
| # NEW: Installs Puter.js and configures the runner for ES Modules | |
| - name: Install Node Dependencies (Puter.js) | |
| run: | | |
| npm init -y | |
| npm pkg set type="module" | |
| npm install @heyputer/puter.js | |
| - name: Run GhostBot | |
| env: | |
| GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} | |
| OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }} | |
| PEXELS_API_KEY: ${{ secrets.PEXELS_KEY }} | |
| YOUTUBE_TOKEN_JSON: ${{ secrets.YOUTUBE_TOKEN_JSON }} | |
| META_ACCESS_TOKEN: ${{ secrets.META_ACCESS_TOKEN }} | |
| FB_PAGE_ID: ${{ secrets.FB_PAGE_ID }} | |
| IG_USER_ID: ${{ secrets.IG_USER_ID }} | |
| PIXABAY_API_KEY: ${{ secrets.PIXABAY_KEY }} | |
| SEARCH_API_KEY: ${{ secrets.SEARCH_API_KEY }} | |
| GOOGLE_CSE_ID: ${{ secrets.GOOGLE_CSE_ID }} | |
| CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| # NEW: Passes the Puter Auth Token directly to your Python/Node pipeline | |
| PUTER_AUTH_TOKEN: ${{ secrets.PUTER_AUTH_TOKEN }} | |
| ELEVEN_API_KEY_1: ${{ secrets.ELEVEN_API_KEY_1 }} | |
| ELEVEN_API_KEY_2: ${{ secrets.ELEVEN_API_KEY_2 }} | |
| run: python main.py | |
| - name: Debug Visuals (Verify Image Downloads) | |
| if: always() | |
| run: | | |
| echo "=== CHECKING DOWNLOADED/GENERATED IMAGES ===" | |
| ls -la assets temp images downloads 2>/dev/null || true | |
| file assets/* temp/* images/* downloads/* 2>/dev/null || true | |
| - name: Commit and Push Memory Bank Updates | |
| if: success() | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add topics.txt | |
| if git diff --staged --quiet; then | |
| echo "No changes in topics.txt to commit." | |
| else | |
| git commit -m "chore: update topics memory bank [skip ci]" | |
| git pull --rebase origin main || true | |
| git push | |
| fi |