name: Generate M3U Playlist with Auto-Organization on: push: branches: - main workflow_dispatch: jobs: build-and-organize: runs-on: ubuntu-22.04 steps: - name: Checkout Repository uses: actions/checkout@v4 - name: Configure Git run: | git config --local user.email "actions@forgejo.plainrock127.xyz" git config --local user.name "IPTV Playlist Bot" - name: Basic Setup run: | # This step previously contained explicit cleanup and Python setup. # These are now handled by the environment or within generate_playlist.py if needed. echo "Basic setup complete." - name: Run Playlist Generation run: | echo "Running playlist generation..." python scripts/generate_playlist.py - name: Commit and Push if Changes run: | git add . if ! git diff-index --quiet HEAD; then echo "Changes detected, committing..." # Get channel count for commit message CHANNELS=$(grep -c "^#EXTINF" playlist.m3u || echo "0") git commit -m "📺 Updated playlist with $CHANNELS channels - $(date '+%Y-%m-%d %H:%M')" git push echo "Changes committed" fi - name: Summary run: | # Get channel count for summary CHANNELS=$(grep -c "^#EXTINF" playlist.m3u || echo "0") echo "=== WORKFLOW COMPLETE ===" echo "✅ Playlist has $CHANNELS channels"