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
uses: actions/checkout@v4
- name: Set up Python
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: Basic Setup
- name: Run Comprehensive Cleanup
run: |
echo "Setting up directories..."
mkdir -p reports/daily
echo "Setup completed"
echo "Running comprehensive cleanup..."
if [ -f comprehensive_cleanup.py ]; then
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
run: |
@ -30,6 +53,9 @@ jobs:
if [ -f bulk_import.m3u ]; then
LINES=$(wc -l < bulk_import.m3u)
echo "Found bulk_import.m3u with $LINES lines"
if [ "$LINES" -gt 2 ]; then
echo "Contains channels to process"
fi
else
echo "Creating empty bulk_import.m3u"
echo '#EXTM3U' > bulk_import.m3u
@ -39,78 +65,74 @@ jobs:
run: |
echo "Running playlist generation..."
if [ -f scripts/generate_playlist.py ]; then
python3 scripts/generate_playlist.py
python scripts/generate_playlist.py
echo "Playlist generation completed"
else
echo "Error: generate_playlist.py not found"
exit 1
fi
- name: Create Simple Report
- name: Check Results
run: |
echo "Creating report..."
echo "Checking results..."
if [ -f playlist.m3u ]; then
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)
REPORT="reports/daily/report_$DATE.md"
echo "# Playlist Report" > "$REPORT"
echo "Generated: $(date)" >> "$REPORT"
echo "Channels: $CHANNELS" >> "$REPORT"
echo "Report created: $REPORT"
echo "# Playlist Report - $(date)" > "$REPORT"
echo "- Channels: $CHANNELS" >> "$REPORT"
echo "- Size: $SIZE" >> "$REPORT"
echo "- Generated: $(date)" >> "$REPORT"
echo "Created report: $REPORT"
else
echo "No playlist found"
echo "No playlist generated"
fi
- name: Clean Old Reports
- name: Clean Import File
run: |
echo "Cleaning old reports..."
cd reports/daily
# Count markdown files
if ls *.md >/dev/null 2>&1; 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"
echo "Cleaning import file..."
if [ -f bulk_import.m3u ]; then
LINES=$(wc -l < bulk_import.m3u)
if [ "$LINES" -gt 2 ]; then
echo '#EXTM3U' > bulk_import.m3u
echo "Cleaned import file for next use"
fi
else
echo "No reports to clean"
fi
cd ../..
- name: Reset Import File
- name: Final Cleanup
run: |
echo "Resetting import file..."
echo '#EXTM3U' > bulk_import.m3u
echo "Import file reset"
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
run: |
echo "Committing changes..."
git add .
if git diff --staged --quiet; then
echo "No changes to commit"
else
if ! git diff --staged --quiet; then
CHANNELS="0"
if [ -f playlist.m3u ]; then
CHANNELS=$(grep -c "^#EXTINF" playlist.m3u || echo "0")
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
echo "Changes committed"
echo "Changes committed successfully"
else
echo "No changes to commit"
fi
- name: Summary
run: |
echo "=== WORKFLOW COMPLETE ==="
echo "Workflow completed successfully!"
if [ -f playlist.m3u ]; then
CHANNELS=$(grep -c "^#EXTINF" playlist.m3u || echo "0")
echo "✅ Playlist has $CHANNELS channels"
echo "Playlist: $CHANNELS channels"
fi
echo "✅ Reports updated"
echo "✅ Repository cleaned"
echo "Repository is clean and organized"