SSSK Monitor #77
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: SSSK Monitor | |
| on: | |
| schedule: | |
| # Peak hours: 19:00 - 23:00 Kyiv (16:00 - 20:00 UTC) every 15 minutes | |
| - cron: '*/15 16-20 * * *' | |
| # Standard mode: Every 5 hours | |
| - cron: '0 */5 * * *' | |
| workflow_dispatch: | |
| inputs: | |
| force: | |
| description: 'Force heavy scan (bypass triggers)' | |
| type: boolean | |
| default: false | |
| jobs: | |
| parse: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update && sudo apt-get install -y tesseract-ocr sqlite3 | |
| cd parser | |
| pip install -r requirements.txt | |
| playwright install --with-deps chromium | |
| # ===== Chain 1: New Parser (SQLite pipeline) — may fail, that's OK ===== | |
| - name: Run Parser (SQLite pipeline) | |
| continue-on-error: true | |
| env: | |
| GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} | |
| run: | | |
| cd parser/src | |
| if [ "${{ github.event.inputs.force }}" == "true" ]; then | |
| python parse_schedule.py --force | |
| else | |
| python parse_schedule.py | |
| fi | |
| # ===== Chain 2: PWA pipeline (stable, keeps the app alive) ===== | |
| - name: Run History Crawler (JSON pipeline) | |
| run: | | |
| cd parser/src | |
| python history_crawler.py | |
| - name: Generate today/tomorrow JSON for PWA | |
| run: | | |
| cd parser/src | |
| python generate_today.py | |
| # ===== Debug: Check what was generated ===== | |
| - name: Debug Workspace | |
| run: | | |
| ls -R parser/data | |
| if [ -f parser/data/schedules.db ]; then | |
| sqlite3 parser/data/schedules.db "SELECT 'SQLite Rows: ' || count(*) FROM schedules;" | |
| else | |
| echo "SQLite DB not found - normal if no heavy scan occurred yet." | |
| fi | |
| # ===== Commit results ===== | |
| - name: Commit and Push | |
| run: | | |
| git config --global user.name "SSSK-Bot" | |
| git config --global user.email "bot@svitlo-starkon.com" | |
| git add parser/data/*.json web/public/data/*.json || true | |
| git commit -m "Auto-update schedules [skip ci]" || echo "No changes to commit" | |
| git push |