Update .forgejo/workflows/generate-m3u.yml
All checks were successful
Generate M3U Playlist / build (push) Successful in 1m4s

This commit is contained in:
stoney420 2025-06-28 00:57:29 +02:00
parent 4cf684e88e
commit 8ef18293c4

View file

@ -34,23 +34,16 @@ jobs:
echo "=== Check for Import File ===" echo "=== Check for Import File ==="
if [ -f bulk_import.m3u ]; then if [ -f bulk_import.m3u ]; then
echo "✅ bulk_import.m3u found in root ($(wc -l < bulk_import.m3u) lines)" echo "✅ bulk_import.m3u found in root ($(wc -l < bulk_import.m3u) lines)"
echo "First 3 lines:"
head -3 bulk_import.m3u
else else
echo "❌ bulk_import.m3u not found in root" echo "❌ bulk_import.m3u not found in root"
fi 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 - name: Setup Directories
run: | run: |
mkdir -p config mkdir -p config
mkdir -p backups mkdir -p backups
mkdir -p reports mkdir -p reports/logs
mkdir -p templates
# Create scripts/__init__.py if missing # Create scripts/__init__.py if missing
if [ ! -f scripts/__init__.py ]; then if [ ! -f scripts/__init__.py ]; then
@ -60,11 +53,6 @@ jobs:
- name: Run Playlist Generation - name: Run Playlist Generation
run: | run: |
echo "=== Running playlist generation ===" 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 python scripts/generate_playlist.py
- name: Check Results - name: Check Results
@ -76,33 +64,63 @@ jobs:
CHANNEL_COUNT=$(grep -c "^#EXTINF" playlist.m3u || echo "0") CHANNEL_COUNT=$(grep -c "^#EXTINF" playlist.m3u || echo "0")
echo "✅ playlist.m3u generated with $CHANNEL_COUNT channels" echo "✅ playlist.m3u generated with $CHANNEL_COUNT channels"
echo "File size: $(du -h playlist.m3u | cut -f1)" echo "File size: $(du -h playlist.m3u | cut -f1)"
echo "First 5 lines:"
head -5 playlist.m3u
else else
echo "❌ playlist.m3u not generated" echo "❌ playlist.m3u not generated"
fi 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 if [ -f channels.txt ]; then
echo "=== channels.txt status ===" echo "=== channels.txt status ==="
echo "Size: $(du -h channels.txt | cut -f1)" echo "Size: $(du -h channels.txt | cut -f1)"
echo "Lines: $(wc -l < channels.txt)" echo "Lines: $(wc -l < channels.txt)"
fi fi
# Check logs
if [ -d reports/logs ]; then
echo "=== Logs directory ==="
ls -la reports/logs/
fi
- name: Commit Changes - name: Commit Changes
run: | 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 if ! git diff --staged --quiet; then
CHANNEL_COUNT="0" CHANNEL_COUNT="0"
if [ -f playlist.m3u ]; then if [ -f playlist.m3u ]; then
CHANNEL_COUNT=$(grep -c "^#EXTINF" playlist.m3u || echo "0") CHANNEL_COUNT=$(grep -c "^#EXTINF" playlist.m3u || echo "0")
fi 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 git push
echo "✅ Repository updated (docs excluded)"
else
echo " No changes to commit"
fi fi