Add .forgejo / workflows / generate-m3u.yml

This commit is contained in:
stoney420 2025-06-27 16:30:39 +02:00
parent 8e1aeb1a92
commit 78d370440e

View file

@ -0,0 +1,82 @@
name: Generate M3U Playlist
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
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.9'
- name: Configure Git
run: |
git config --local user.email "actions@forgejo.plainrock127.xyz"
git config --local user.name "Gitea Actions Bot"
- name: Set file permissions and debug
run: |
echo "=== Current user and permissions ==="
whoami
pwd
ls -la
echo "=== Setting file permissions ==="
chmod 664 channels.txt || echo "Could not chmod channels.txt"
chmod 664 bulk_import.m3u || echo "Could not chmod bulk_import.m3u (might not exist)"
chmod 775 . || echo "Could not chmod directory"
echo "=== Files before processing ==="
echo "channels.txt line count:"
wc -l channels.txt || echo "channels.txt not found"
echo "bulk_import.m3u exists:"
ls -la bulk_import.m3u || echo "bulk_import.m3u not found"
- name: Generate M3U
run: python generate_playlist.py
- name: Debug after processing
run: |
echo "=== Files after processing ==="
ls -la
echo "=== channels.txt line count after ==="
wc -l channels.txt || echo "channels.txt not found"
echo "=== bulk_import.m3u still exists? ==="
ls -la bulk_import.m3u || echo "bulk_import.m3u not found (good!)"
echo "=== Log content ==="
cat playlist_update.log || echo "No log file"
echo "=== playlist.m3u line count ==="
wc -l playlist.m3u || echo "playlist.m3u not found"
- name: Prepare for Pages
run: |
mkdir -p docs
cp playlist.m3u docs/playlist.m3u
cp playlist_update.log docs/playlist_update.log || true
- name: Commit and Push
run: |
git add channels.txt || echo "No channels.txt to add"
git add playlist.m3u || echo "No playlist.m3u to add"
git add playlist_update.log || echo "No playlist_update.log to add"
git add docs/playlist.m3u || echo "No docs/playlist.m3u to add"
git add docs/playlist_update.log || echo "No docs/playlist_update.log to add"
echo "=== Git status ==="
git status
if git diff --staged --quiet; then
echo "No changes to commit"
else
git commit -m "Update M3U playlist via Gitea Actions - $(date)"
git push
fi
env:
GITEA_TOKEN