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