Update .forgejo/workflows/generate-m3u.yml
All checks were successful
📺 Generate M3U Playlist / build (push) Successful in 1m42s

This commit is contained in:
stoney420 2025-06-27 18:21:57 +02:00
parent 2327797dd8
commit 8be1d98d7e

View file

@ -12,6 +12,8 @@ jobs:
steps:
- name: 📥 Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 🐍 Set up Python
uses: actions/setup-python@v5
@ -73,8 +75,13 @@ jobs:
echo "❌ No log file found"
fi
- name: 💾 Commit changes
- name: 💾 Commit and push changes
run: |
echo "=== Preparing to commit ==="
# Pull latest changes first to avoid conflicts
git pull origin main || echo "Pull failed, continuing anyway"
# Add files
git add channels.txt || true
git add playlist.m3u || true
@ -84,16 +91,23 @@ jobs:
# Check if anything to commit
if git diff --staged --quiet; then
echo "No changes to commit"
echo " No changes to commit"
else
CHANNEL_COUNT="0"
if [ -f playlist.m3u ]; then
CHANNEL_COUNT=$(grep -c "^#EXTINF" playlist.m3u || echo "0")
fi
echo "📝 Committing changes..."
git commit -m "📺 Updated playlist: $CHANNEL_COUNT channels ($(date '+%Y-%m-%d %H:%M'))"
git push
echo "✅ Changes committed"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Try to push, with retry if needed
echo "🚀 Pushing changes..."
if ! git push origin main; then
echo "⚠️ Push failed, trying to pull and push again..."
git pull origin main --rebase || true
git push origin main || echo "❌ Push failed again - manual intervention may be needed"
fi
echo "✅ Changes committed and pushed"
fi