Skip to content

Update Livestreams Data #423

Update Livestreams Data

Update Livestreams Data #423

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