Update Livestreams Data #418
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: Update Livestreams Data | |
| on: | |
| schedule: | |
| # Runs every 6 hours so new streams and updated descriptions are picked up | |
| - cron: '0 */6 * * *' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| update-livestreams: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| data_changed: ${{ steps.fetch.outputs.data_changed }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install dependencies | |
| run: pip install --quiet requests | |
| - name: Fetch playlist data | |
| id: fetch | |
| env: | |
| YOUTUBE_API_KEY: ${{ secrets.YOUTUBE_API_KEY }} | |
| PLAYLIST_ID: PLc7fktTRMBow1ksFW020hx2XEKabaD5Vd | |
| run: python scripts/fetch-livestreams.py | |
| - name: Commit and push if data changed | |
| if: steps.fetch.outputs.data_changed == 'true' | |
| run: | | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| git add data/livestreams.json | |
| git diff --staged --quiet || git commit -m "chore: update livestreams data" | |
| git push |