Sonyliv Upload Links #5627
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Sonyliv Upload Links | |
on: | |
schedule: | |
- cron: '*/2 * * * *' # Runs every 20 minutes | |
push: | |
branches: | |
- main | |
jobs: | |
fetch_and_upload: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.LIV_TOKEN }} # Use the GitHub token for authentication | |
- name: Remove existing files | |
run: rm -f sonyliv.json sonyliv.m3u | |
- name: Configure Git | |
run: | | |
git config --global user.name "auto-update-bot" | |
git config --global user.email "auto-update-bot@users.noreply.github.com" | |
git remote set-url origin https://${{ secrets.LIV_TOKEN }}@github.com/abid58b/SonyLivPlayList.git | |
- name: Fetch data from APIs | |
run: | | |
curl -o sonyliv.json ${{ secrets.SONYLIV_JSON_API }} | |
curl -o sonyliv.m3u ${{ secrets.SONYLIV_M3U_API }} | |
- name: Commit and push changes | |
run: | | |
git add sonyliv.json sonyliv.m3u | |
git fetch origin main | |
git reset --soft origin/main | |
if git diff --cached --quiet; then | |
echo "No changes to commit" | |
else | |
git commit -m "Fetch latest data" | |
git push origin main | |
fi |