Sync Upcoming TV Episodes #114
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: Sync Upcoming TV Episodes | |
| on: | |
| schedule: | |
| - cron: '0 2 * * *' # daily 8:00 AM Bangladesh Time (UTC+6) | |
| workflow_dispatch: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'scripts/sync_upcoming_episodes.py' | |
| - 'models.py' | |
| - 'api/tmdb_client.py' | |
| permissions: | |
| contents: read | |
| issues: write | |
| jobs: | |
| sync-episodes: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Run sync | |
| env: | |
| DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
| TMDB_API_KEY: ${{ secrets.TMDB_API_KEY }} | |
| SECRET_KEY: ${{ secrets.SECRET_KEY }} | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| CHROMA_API_KEY: ${{ secrets.CHROMA_API_KEY }} | |
| CHROMA_TENANT: ${{ secrets.CHROMA_TENANT }} | |
| CHROMA_DATABASE: ${{ secrets.CHROMA_DATABASE }} | |
| run: python scripts/sync_upcoming_episodes.py | |
| - name: Open issue on failure | |
| if: failure() | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| github.rest.issues.create({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| title: '🚨 TV Episode Sync Failed', | |
| body: `Sync failed. [View run](${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId})`, | |
| labels: ['automation', 'bug'] | |
| }) |