This repository has been archived by the owner on May 18, 2024. It is now read-only.
Update IPTV playlists #485
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: Update IPTV playlists | |
on: | |
push: | |
branches: ["main", "dev"] | |
paths: "scripts/IPTV_playlists_functions.sh" | |
pull_request: | |
branches: ["main", "dev"] | |
paths: "scripts/IPTV_playlists_functions.sh" | |
schedule: | |
- cron: "0 20 * * *" | |
workflow_dispatch: | |
watch: | |
types: [started] | |
concurrency: | |
group: ${{ github.workflow }} | |
cancel-in-progress: true | |
jobs: | |
update_playlists: | |
if: ${{ github.repository_owner == 'KevinNitroG' }} | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Update time | |
run: | | |
echo "update_time=$(TZ="Asia/Bangkok" date "+%d-%m-%y at %I:%M %p")" >> $GITHUB_ENV | |
- name: Update playlists | |
run: scripts/update_IPTV_playlists.sh | |
- name: Check empty files | |
run: scripts/check_empty_files.sh | |
- name: Update time in README | |
run: | | |
mv -f README_m3u.md README.md | |
rm -rf ./.github ./scripts .gitignore .whitesource renovate.json .deepsource.toml _config.yml | |
sed -i "s/- \*\*Time:\*\*.*/- \*\*Time:\*\* ${{ env.update_time }}/" ./README.md | |
- name: Push to Github | |
run: | | |
git config --global user.name ${{ secrets.MY_USERNAME }} | |
git config --global user.email ${{ secrets.MY_EMAIL }} | |
git checkout --orphan m3u_modified | |
git add . | |
git commit -m "Updated on ${{ env.update_time }}" | |
if git ls-remote --exit-code --heads origin m3u; then | |
git push origin --delete m3u | |
fi | |
git branch -m m3u | |
git push -f origin m3u | |
retry_if_fail: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
needs: update_playlists | |
if: failure() | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Update time | |
run: | | |
echo "update_time=$(TZ="Asia/Bangkok" date "+%d-%m-%y at %I:%M %p")" >> $GITHUB_ENV | |
- name: Update playlists | |
run: scripts/update_IPTV_playlists.sh | |
- name: Check empty files | |
continue-on-error: true | |
run: scripts/check_empty_files.sh | |
- name: Update time in README | |
run: | | |
mv -f README_m3u.md README.md | |
rm -rf ./.github ./scripts .gitignore .whitesource renovate.json .deepsource.toml _config.yml | |
sed -i "s/- \*\*Time:\*\*.*/- \*\*Time:\*\* ${{ env.update_time }}/" ./README.md | |
- name: Push to Github | |
run: | | |
git config --global user.name ${{ secrets.MY_USERNAME }} | |
git config --global user.email ${{ secrets.MY_EMAIL }} | |
git checkout --orphan m3u_modified | |
git add . | |
git commit -m "Updated on ${{ env.update_time }}" | |
if git ls-remote --exit-code --heads origin m3u; then | |
git push origin --delete m3u | |
fi | |
git branch -m m3u | |
git push -f origin m3u |