diff --git a/.github/workflows/merge-fancode-playlist.yml b/.github/workflows/merge-fancode-playlist.yml new file mode 100644 index 0000000..aa74efc --- /dev/null +++ b/.github/workflows/merge-fancode-playlist.yml @@ -0,0 +1,45 @@ +name: Merge Fancode Playlist with My Playlist + +on: + schedule: + - cron: '0 */6 * * *' # Runs every 6 hours + workflow_dispatch: # Allows manual trigger too + +jobs: + merge: + runs-on: ubuntu-latest + + steps: + - name: Checkout Nadeko Repo + uses: actions/checkout@v3 + + - name: Download Fancode Playlist + run: | + curl -L "https://raw.githubusercontent.com/drmlive/fancode-live-events/main/fancode.m3u" -o fancode_playlist.m3u + + - name: Merge Playlists with Headers + run: | + echo "# --- Fancode Playlist: drmlive/fancode-live-events ---" > merged_playlist.m3u + cat fancode_playlist.m3u >> merged_playlist.m3u + echo "" >> merged_playlist.m3u + echo "# --- Your Playlist: MaskedWolff/maskedwolf ---" >> merged_playlist.m3u + cat my_playlist.m3u >> merged_playlist.m3u + + - name: Commit and Push Merged Playlist + run: | + git config --global user.name "GitHub Actions" + git config --global user.email "github-actions@users.noreply.github.com" + + # Pull the latest changes from the remote repository + git pull origin main --rebase || echo "No rebase needed" + + # Add the merged playlist file + git add merged_playlist.m3u + + # Commit the changes if there are updates + if git diff --cached --quiet; then + echo "No changes to commit" + else + git commit -m "Auto-merged Fancode playlist with My Playlist" + git push origin main + fi