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