name: M3U Playlist Dead Link Checker

on:
  schedule:
    # Run daily at 2 AM UTC
    - cron: '0 2 * * *'
  push:
    paths:
      - 'mystique.m3u'
      # Trigger when the playlist file changes

jobs:
  check-m3u-links:
    runs-on: docker
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Set up Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '20'

      - name: Check M3U playlist for dead links
        run: node .forgejo/scripts/check_m3u_links.js