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

This commit is contained in:
stoney420 2025-06-28 03:49:44 +02:00
parent 983bf0673a
commit 08acb6998d

View file

@ -86,10 +86,12 @@ jobs:
REPORT_COUNT=$(ls -1 playlist_report_*.md report_*.md 2>/dev/null | wc -l)
if [ "$REPORT_COUNT" -gt 3 ]; then
ls -t playlist_report_*.md report_*.md 2>/dev/null | tail -n +4 | while read old_report; do
if [ -f "$old_report" ]; then
REPORT_DATE=$(echo "$old_report" | sed 's/.*_//; s/\.md//; s/\(....\)\(..\)\(..\).*/\1-\2/')
mkdir -p "../archive/$REPORT_DATE"
mv "$old_report" "../archive/$REPORT_DATE/"
echo "Archived: $old_report"
fi
done
fi
cd - > /dev/null
@ -122,20 +124,28 @@ jobs:
- name: Archive Old Reports
run: |
echo "Managing archives..."
# Archive reports older than 7 days - using GNU date format for Ubuntu
CUTOFF_DATE=$(date -d '7 days ago' +%s)
for report_file in reports/daily/playlist_report_*.md reports/daily/report_*.md; do
if [ -f "$report_file" ]; then
FILE_DATE=$(stat -c %Y "$report_file" 2>/dev/null || echo "0")
if [ "$FILE_DATE" -lt "$CUTOFF_DATE" ] && [ "$FILE_DATE" -gt "0" ]; then
BASENAME=$(basename "$report_file")
# Simple archive management - keep only recent reports
if [ -d reports/daily ]; then
cd reports/daily
# Count all report files
TOTAL_REPORTS=$(ls -1 playlist_report_*.md report_*.md 2>/dev/null | wc -l)
echo "Found $TOTAL_REPORTS total reports"
# If more than 5 reports, archive the oldest ones
if [ "$TOTAL_REPORTS" -gt 5 ]; then
echo "Archiving oldest reports..."
ls -t playlist_report_*.md report_*.md 2>/dev/null | tail -n +6 | while read old_report; do
if [ -f "$old_report" ]; then
BASENAME=$(basename "$old_report")
REPORT_DATE=$(echo "$BASENAME" | sed 's/.*_//; s/\.md//; s/\(....\)\(..\)\(..\).*/\1-\2/')
mkdir -p "reports/archive/$REPORT_DATE"
mv "$report_file" "reports/archive/$REPORT_DATE/"
mkdir -p "../archive/$REPORT_DATE"
mv "$old_report" "../archive/$REPORT_DATE/"
echo "Archived old report: $BASENAME"
fi
fi
done
fi
cd - > /dev/null
fi
# Show archive status
ACTIVE_REPORTS=$(ls reports/daily/playlist_report_*.md report_*.md 2>/dev/null | wc -l)
@ -176,7 +186,7 @@ jobs:
ACTIVE_REPORTS=$(ls reports/daily/playlist_report_*.md report_*.md 2>/dev/null | wc -l)
git commit -m "📺 Updated playlist: $CHANNELS channels across $COUNTRIES countries - Reports: $ACTIVE_REPORTS/3 active - $(date '+%Y-%m-%d %H:%M')"
git commit -m "📺 Updated playlist: $CHANNELS channels across $COUNTRIES countries - Reports: $ACTIVE_REPORTS active - $(date '+%Y-%m-%d %H:%M')"
git push
echo "Changes committed successfully"
else