From 8ef18293c43c428bba31c6f85886dc051ea1b452 Mon Sep 17 00:00:00 2001 From: stoney420 Date: Sat, 28 Jun 2025 00:57:29 +0200 Subject: [PATCH] Update .forgejo/workflows/generate-m3u.yml --- .forgejo/workflows/generate-m3u.yml | 68 ++++++++++++++++++----------- 1 file changed, 43 insertions(+), 25 deletions(-) diff --git a/.forgejo/workflows/generate-m3u.yml b/.forgejo/workflows/generate-m3u.yml index 832ce97..df348c2 100644 --- a/.forgejo/workflows/generate-m3u.yml +++ b/.forgejo/workflows/generate-m3u.yml @@ -34,23 +34,16 @@ jobs: echo "=== Check for Import File ===" if [ -f bulk_import.m3u ]; then echo "✅ bulk_import.m3u found in root ($(wc -l < bulk_import.m3u) lines)" - echo "First 3 lines:" - head -3 bulk_import.m3u else echo "❌ bulk_import.m3u not found in root" fi - - if [ -f channels.txt ]; then - echo "✅ channels.txt found ($(du -h channels.txt | cut -f1))" - else - echo "❌ channels.txt not found" - fi - name: Setup Directories run: | mkdir -p config mkdir -p backups - mkdir -p reports + mkdir -p reports/logs + mkdir -p templates # Create scripts/__init__.py if missing if [ ! -f scripts/__init__.py ]; then @@ -60,11 +53,6 @@ jobs: - name: Run Playlist Generation run: | echo "=== Running playlist generation ===" - echo "Current directory: $(pwd)" - echo "Available files:" - ls -la - - # Run from root directory, not scripts directory python scripts/generate_playlist.py - name: Check Results @@ -76,33 +64,63 @@ jobs: CHANNEL_COUNT=$(grep -c "^#EXTINF" playlist.m3u || echo "0") echo "✅ playlist.m3u generated with $CHANNEL_COUNT channels" echo "File size: $(du -h playlist.m3u | cut -f1)" - echo "First 5 lines:" - head -5 playlist.m3u else echo "❌ playlist.m3u not generated" fi - if [ -f playlist_update.log ]; then - echo "=== Log content (last 30 lines) ===" - tail -30 playlist_update.log - else - echo "❌ No log file found" - fi - if [ -f channels.txt ]; then echo "=== channels.txt status ===" echo "Size: $(du -h channels.txt | cut -f1)" echo "Lines: $(wc -l < channels.txt)" fi + # Check logs + if [ -d reports/logs ]; then + echo "=== Logs directory ===" + ls -la reports/logs/ + fi + - name: Commit Changes run: | - git add . + echo "=== Preparing to commit (excluding docs) ===" + + # Remove docs folder from tracking if it exists + if [ -d docs ]; then + echo "Removing docs folder from repository" + git rm -rf docs/ || true + fi + + # Remove old playlist_update.log from root if it exists + if [ -f playlist_update.log ]; then + echo "Removing old playlist_update.log from root" + git rm playlist_update.log || true + fi + + # Add specific files/directories only + git add bulk_import.m3u || true + git add channels.txt || true + git add playlist.m3u || true + git add scripts/ || true + git add config/ || true + git add reports/ || true + git add backups/ || true + git add templates/ || true + git add .forgejo/ || true + git add README.md || true + + # Explicitly do NOT add docs folder or old logs + echo "Skipping docs/ folder and old logs" + if ! git diff --staged --quiet; then CHANNEL_COUNT="0" if [ -f playlist.m3u ]; then CHANNEL_COUNT=$(grep -c "^#EXTINF" playlist.m3u || echo "0") fi - git commit -m "Updated playlist: $CHANNEL_COUNT channels" + + git commit -m "📺 Updated playlist: $CHANNEL_COUNT channels ($(date '+%Y-%m-%d %H:%M')) - Clean repo" git push + + echo "✅ Repository updated (docs excluded)" + else + echo "ℹ️ No changes to commit" fi \ No newline at end of file