Update .forgejo/workflows/generate-m3u.yml

This commit is contained in:
stoney420 2025-06-29 04:57:48 +02:00
parent dc1ea7ec13
commit dca7d082bd

View file

@ -8,7 +8,8 @@ on:
jobs:
build-and-organize:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest # Changed to ubuntu-latest for broader Forgejo compatibility
steps:
- name: Checkout Repository
uses: actions/checkout@v4
@ -51,39 +52,14 @@ jobs:
- name: Run Playlist Generation
run: |
echo "Running playlist generation..."
cd scripts
if [ -f generate_playlist.py ]; then
echo "Found generate_playlist.py, executing..."
python3 generate_playlist.py
echo "Playlist generation completed"
else
echo "Error: generate_playlist.py not found"
exit 1
fi
- name: Create Simple Report
run: |
echo "Creating report..."
if [ -f playlist.m3u ]; then
CHANNELS=$(grep -c "^#EXTINF" playlist.m3u || echo "0")
echo "Found $CHANNELS channels in playlist"
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"
else
echo "No playlist found"
fi
python3 scripts/generate_playlist.py
- name: Clean Old Reports
run: |
echo "Cleaning old reports..."
cd reports/daily
# Ensure we are in the correct directory before listing files
if [ -d reports/daily ]; then
cd reports/daily || exit 1 # Exit if directory change fails
if ls *.md >/dev/null 2>&1; then
COUNT=$(ls *.md | wc -l)
echo "Found $COUNT reports"
@ -95,7 +71,10 @@ jobs:
else
echo "No reports to clean"
fi
cd ../..
cd ../.. # Go back to root
else
echo "Reports daily directory not found, skipping cleanup."
fi
- name: Reset Import File
run: |
@ -124,7 +103,8 @@ jobs:
echo "=== WORKFLOW COMPLETE ==="
if [ -f playlist.m3u ]; then
CHANNELS=$(grep -c "^#EXTINF" playlist.m3u || echo "0")
echo "✅ Playlist has $CHANNELS channels"
echo "Final playlist.m3u has $CHANNELS channels."
else
echo "No playlist.m3u file found."
fi
echo "✅ Reports updated"
echo "✅ Repository cleaned"