Update .forgejo/workflows/generate-m3u.yml
Some checks failed
Generate M3U Playlist with Auto-Organization / build-and-organize (push) Failing after 1m29s

This commit is contained in:
stoney420 2025-06-28 06:58:53 +02:00
parent 9bfac06327
commit 9978ea85d7

View file

@ -13,16 +13,39 @@ jobs:
- name: Checkout Repository - name: Checkout Repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Configure Git - name: Configure Git
run: | run: |
git config --local user.email "actions@forgejo.plainrock127.xyz" git config --local user.email "actions@forgejo.plainrock127.xyz"
git config --local user.name "IPTV Playlist Bot" git config --local user.name "IPTV Playlist Bot"
- name: Basic Setup - name: Run Comprehensive Cleanup
run: | run: |
echo "Setting up directories..." echo "Running comprehensive cleanup..."
mkdir -p reports/daily if [ -f comprehensive_cleanup.py ]; then
echo "Setup completed" python comprehensive_cleanup.py
echo "Comprehensive cleanup completed"
else
echo "Cleanup already completed"
fi
- name: Basic Repository Maintenance
run: |
echo "Running basic maintenance..."
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
find . -name "*.pyc" -delete 2>/dev/null || true
find . -name "*.tmp" -delete 2>/dev/null || true
find . -name "*~" -delete 2>/dev/null || true
mkdir -p reports/logs reports/daily backups config templates
find . -maxdepth 1 -name "*.log" -exec mv {} reports/logs/ \; 2>/dev/null || true
if [ ! -f scripts/__init__.py ]; then
echo '# IPTV Scripts Package' > scripts/__init__.py
fi
echo "Basic maintenance completed"
- name: Check Import File - name: Check Import File
run: | run: |
@ -30,6 +53,9 @@ jobs:
if [ -f bulk_import.m3u ]; then if [ -f bulk_import.m3u ]; then
LINES=$(wc -l < bulk_import.m3u) LINES=$(wc -l < bulk_import.m3u)
echo "Found bulk_import.m3u with $LINES lines" echo "Found bulk_import.m3u with $LINES lines"
if [ "$LINES" -gt 2 ]; then
echo "Contains channels to process"
fi
else else
echo "Creating empty bulk_import.m3u" echo "Creating empty bulk_import.m3u"
echo '#EXTM3U' > bulk_import.m3u echo '#EXTM3U' > bulk_import.m3u
@ -39,78 +65,74 @@ jobs:
run: | run: |
echo "Running playlist generation..." echo "Running playlist generation..."
if [ -f scripts/generate_playlist.py ]; then if [ -f scripts/generate_playlist.py ]; then
python3 scripts/generate_playlist.py python scripts/generate_playlist.py
echo "Playlist generation completed" echo "Playlist generation completed"
else else
echo "Error: generate_playlist.py not found" echo "Error: generate_playlist.py not found"
exit 1 exit 1
fi fi
- name: Create Simple Report - name: Check Results
run: | run: |
echo "Creating report..." echo "Checking results..."
if [ -f playlist.m3u ]; then if [ -f playlist.m3u ]; then
CHANNELS=$(grep -c "^#EXTINF" playlist.m3u || echo "0") CHANNELS=$(grep -c "^#EXTINF" playlist.m3u || echo "0")
echo "Found $CHANNELS channels in playlist" SIZE=$(du -h playlist.m3u | cut -f1)
echo "Generated playlist: $CHANNELS channels ($SIZE)"
# Create simple report
DATE=$(date +%Y%m%d_%H%M%S) DATE=$(date +%Y%m%d_%H%M%S)
REPORT="reports/daily/report_$DATE.md" REPORT="reports/daily/report_$DATE.md"
echo "# Playlist Report - $(date)" > "$REPORT"
echo "# Playlist Report" > "$REPORT" echo "- Channels: $CHANNELS" >> "$REPORT"
echo "Generated: $(date)" >> "$REPORT" echo "- Size: $SIZE" >> "$REPORT"
echo "Channels: $CHANNELS" >> "$REPORT" echo "- Generated: $(date)" >> "$REPORT"
echo "Created report: $REPORT"
echo "Report created: $REPORT"
else else
echo "No playlist found" echo "No playlist generated"
fi fi
- name: Clean Old Reports - name: Clean Import File
run: | run: |
echo "Cleaning old reports..." echo "Cleaning import file..."
cd reports/daily if [ -f bulk_import.m3u ]; then
# Count markdown files LINES=$(wc -l < bulk_import.m3u)
if ls *.md >/dev/null 2>&1; then if [ "$LINES" -gt 2 ]; then
COUNT=$(ls *.md | wc -l)
echo "Found $COUNT reports"
if [ "$COUNT" -gt 3 ]; then
echo "Removing excess reports..."
ls -t *.md | tail -n +4 | xargs rm -f
echo "Cleanup done"
fi
else
echo "No reports to clean"
fi
cd ../..
- name: Reset Import File
run: |
echo "Resetting import file..."
echo '#EXTM3U' > bulk_import.m3u echo '#EXTM3U' > bulk_import.m3u
echo "Import file reset" echo "Cleaned import file for next use"
fi
fi
- name: Final Cleanup
run: |
echo "Final cleanup..."
find . -name "*.pyc" -delete 2>/dev/null || true
find . -name "*~" -delete 2>/dev/null || true
find . -name "*.swp" -delete 2>/dev/null || true
rm -f comprehensive_cleanup.py 2>/dev/null || true
echo "Final cleanup completed"
- name: Commit Changes - name: Commit Changes
run: | run: |
echo "Committing changes..." echo "Committing changes..."
git add . git add .
if git diff --staged --quiet; then if ! git diff --staged --quiet; then
echo "No changes to commit"
else
CHANNELS="0" CHANNELS="0"
if [ -f playlist.m3u ]; then if [ -f playlist.m3u ]; then
CHANNELS=$(grep -c "^#EXTINF" playlist.m3u || echo "0") CHANNELS=$(grep -c "^#EXTINF" playlist.m3u || echo "0")
fi fi
git commit -m "📺 Updated playlist with $CHANNELS channels - $(date '+%Y-%m-%d %H:%M')" git commit -m "Updated playlist: $CHANNELS channels - $(date '+%Y-%m-%d %H:%M')"
git push git push
echo "Changes committed" echo "Changes committed successfully"
else
echo "No changes to commit"
fi fi
- name: Summary - name: Summary
run: | run: |
echo "=== WORKFLOW COMPLETE ===" echo "Workflow completed successfully!"
if [ -f playlist.m3u ]; then if [ -f playlist.m3u ]; then
CHANNELS=$(grep -c "^#EXTINF" playlist.m3u || echo "0") CHANNELS=$(grep -c "^#EXTINF" playlist.m3u || echo "0")
echo "✅ Playlist has $CHANNELS channels" echo "Playlist: $CHANNELS channels"
fi fi
echo "✅ Reports updated" echo "Repository is clean and organized"
echo "✅ Repository cleaned"