ScoutBot — Scrape (Weekly, Sundays) #67
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: ScoutBot — Daily Run | |
| on: | |
| # ── Scheduled: once daily at 12:00 PM Lagos (WAT = UTC+1) ────────────────── | |
| # GitHub Actions cron uses UTC. 11:00 UTC = 12:00 PM WAT. | |
| schedule: | |
| - cron: "0 11 * * *" | |
| # ── Manual trigger from the Actions tab ──────────────────────────────────── | |
| workflow_dispatch: | |
| jobs: | |
| run-pipeline: | |
| name: Scrape → Cleanup → Email Digest | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 # safety net — kills the job if it hangs | |
| steps: | |
| # 1. Check out code | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| # 2. Set up Python 3.11 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| cache: "pip" | |
| # 3. Install dependencies | |
| - name: Install dependencies | |
| run: pip install -r requirements.txt | |
| # 4. Write the Google service account JSON from the base64 secret | |
| - name: Decode service account credentials | |
| run: | | |
| echo "${{ secrets.GOOGLE_SERVICE_ACCOUNT_JSON_B64 }}" \ | |
| | base64 --decode > service_account.json | |
| # 5. Build .env from secrets | |
| - name: Write .env file | |
| run: | | |
| cat > .env << EOF | |
| SENDER_EMAIL=${{ secrets.SENDER_EMAIL }} | |
| GMAIL_APP_PASSWORD=${{ secrets.GMAIL_APP_PASSWORD }} | |
| SPREADSHEET_ID=${{ secrets.SPREADSHEET_ID }} | |
| FORM_SHEET_ID=1dFcnVvQjWkuYhN1rplICTY0j88KgvGqQ3FzYId2ru4s | |
| RECIPIENT_EMAILS=${{ secrets.RECIPIENT_EMAILS }} | |
| GOOGLE_SERVICE_ACCOUNT_JSON=service_account.json | |
| EOF | |
| # 6. Run the full pipeline (scrape → cleanup → email) | |
| - name: Run ScoutBot pipeline | |
| run: python run.py | |
| # 7. Clean up credentials — never leave secrets on the runner | |
| - name: Remove credentials | |
| if: always() | |
| run: | | |
| rm -f service_account.json .env |