Update .forgejo/workflows/generate-m3u.yml
All checks were successful
📺 Generate M3U Playlist / build (push) Successful in 1m42s
All checks were successful
📺 Generate M3U Playlist / build (push) Successful in 1m42s
This commit is contained in:
parent
2327797dd8
commit
8be1d98d7e
1 changed files with 21 additions and 7 deletions
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue