my-private-iptv-m3u/.forgejo/workflows/generate-m3u.yml

57 lines
1.7 KiB
YAML
Raw Normal View History

name: Generate M3U Playlist with Auto-Organization
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build-and-organize:
runs-on: ubuntu-22.04
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11' # Ensure Python 3.11 is available
- name: Configure Git
run: |
git config --local user.email "actions@forgejo.plainrock127.xyz"
git config --local user.name "IPTV Playlist Bot"
- name: Basic Setup
run: |
# This step previously contained explicit cleanup and Python setup.
# These are now handled by the environment or within generate_playlist.py if needed.
echo "Basic setup complete."
- name: Run Playlist Generation
run: |
echo "Running playlist generation..."
python scripts/generate_playlist.py
- name: Commit and Push if Changes
run: |
git add .
if ! git diff-index --quiet HEAD; then
echo "Changes detected, committing..."
# Fetch latest changes from remote and rebase local changes on top
git pull --rebase origin main
# Get channel count for commit message
CHANNELS=$(grep -c "^#EXTINF" playlist.m3u || echo "0")
git commit -m "📺 Updated playlist with $CHANNELS channels - $(date '+%Y-%m-%d %H:%M')"
git push
echo "Changes committed"
fi
- name: Summary
run: |
# Get channel count for summary
CHANNELS=$(grep -c "^#EXTINF" playlist.m3u || echo "0")
echo "=== WORKFLOW COMPLETE ==="
echo "✅ Playlist has $CHANNELS channels"