Update .forgejo/workflows/generate-m3u.yml
All checks were successful
Generate M3U Playlist / build (push) Successful in 1m4s
All checks were successful
Generate M3U Playlist / build (push) Successful in 1m4s
This commit is contained in:
parent
4cf684e88e
commit
8ef18293c4
1 changed files with 43 additions and 25 deletions
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue