name: Generate M3U Playlist on: push: branches: - main workflow_dispatch: jobs: build: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: '3.11' - name: Configure Git run: | git config --local user.email "actions@forgejo.plainrock127.xyz" git config --local user.name "IPTV Playlist Bot" - name: Clean Repository run: | find . -name "__pycache__" -type d -exec rm -rf {} + || true find . -name "*.pyc" -delete || true mkdir -p reports/logs mv *.log reports/logs/ 2>/dev/null || true - name: Setup run: | mkdir -p config backups templates echo '# Scripts package' > scripts/__init__.py - name: Generate Playlist run: python scripts/generate_playlist.py - name: Check Results run: | if [ -f playlist.m3u ]; then CHANNELS=$(grep -c "^#EXTINF" playlist.m3u || echo "0") echo "Generated $CHANNELS channels" fi - name: Commit run: | git add . if ! git diff --staged --quiet; then git commit -m "📺 Updated playlist - $(date '+%Y-%m-%d %H:%M')" git push fi